How to host a simple Umbraco site in Azure as cheap as possible

This post is mainly targeted at small Umbraco sites such as this blog you are reading from right now. Your mileage may vary.

by Matthew Hart on February 16, 2020

Why Azure?

There are many hosting providers you could use to host your Umbraco site some at a cheaper rate but why am I using Azure to host mine? PaaS or Platform as a service. Ever since I started working with Azure I loved the idea of Web Apps. Don't get me wrong there are some scenarios where its great to have your own Virtual Machine (IaaS). But with ever increasing threats and exploits discovered its great that I can sit back and let Azure take the hassle of updating the underlying software/hardware for me. Everything is more abstract, I don't need to worry about whats on the virtual machine itself or maintain it in any way.

What resources am I using in Azure?

It's quite basic really, I am running this site on an Azure Web App with a SQL Database, that's it. I have an additional web app that's on a separate free tier App Service Plan (ASP) that I use as a staging environment and the app for production is on a paid app service plan (D1: Shared). To get a custom domain name I needed to use a paid ASP but if you are happy to have your url ending with azurewebsites.net than technically you could run your umbraco site on a free ASP tier. The problem with this is that you won't be able to leverage Cloudflare as you don't control the azurewebsites.net domain... I suggest an alternative off topic solution further down in this post if you are looking for something lighter.

Any tricks to cut costs?

Cloudflare

Yes! I use Cloudflare to handle the majority of the traffic and HTTPS certificate. However if you read my previous post Six ways to secure your Umbraco back office the HTTPS protection is only half way, so from a security standpoint logging into the back office or using logins on the front end such as a forum login via the main site url could compromise credentials in transit. Since I have Cloudflare on the front that reduces the cost in Azure as the web app receives less requests to it but it means I have to log into Umbraco via the azurewebsites.net domain not mattou07.net to have full HTTPS protection.

Cloudflare performs its own caching in front of the web server and a Global CDN which provides fast performance for visitors around the globe. Try running a test on a cloudflare enabled site using GTMetrix: https://gtmetrix.com/ not bad for a free service.

 

You can see more about the free plan here: https://www.cloudflare.com/en-gb/plans/

Lastly, is Cloudflares domain registrar, I am sure you have noticed the crazy discounts for new domains when you first buy them and then suddenly the price increases dramatically on renewal day. Cloudflare explains that this is unnecessary and essentially from their end they just need to submit a renewal request to a registry API. They are offering cheap prices for domains without the markup price on renewal day which is a win in my book. You could also take it further and buy a domain from a registrar that is selling it really cheaply and then move it to Cloudflare to take advantage of the cheaper renewal. You can read more about it here: https://www.cloudflare.com/learning/dns/what-is-cloudflare-registrar/

Azure

Region

What Azure region you pick matters, so if you are based in the UK you could host your resources in North Europe to cut costs. North Europe is a data center in Dublin so its not too far! You may notice other cheaper alternatives for your location by using the Azure pricing calculator. However if you have specific legal requirements you may need to reconsider using a data-center in the UK, for example Brexit may cause a divergence in laws with EU nations that you may not be in compliance with. However I don't imagine many of you small time bloggers needing to think about legal requirements.

Back to the price differences, you can't see much of a difference with a D1 ASP but with a B1 you can see some differences, especially as you scale it up. Below are two B1 App Service plans but one is in North Europe and the other is in UK South:

You notice more savings as you increase the scale of the instance, below we are now at B3 scale and North Europe is saving us £40 per month compared to UK South.

However we are going off topic, this mainly concerns entities such as companies rather than us simple blog folk but its something to consider when you want to start adding more resources or increasing scale.

Storage

Another thing to think about is space. The ASP I have only has 1GB of space, if you plan to upload lots of images into your posts that 1GB will run out fast! Luckily there is an Umbraco package called Umbraco File System Providers that lets you stream your media from an Azure Blob storage account. I haven't needed to do this myself yet but looking at the calculator I could have 20GB of blob storage for £0.38. However don't take this too seriously once the storage account is in place you could be using more resources and end up paying slightly more. Again using different regions gives you different prices.

Re-configuring Umbraco

If you plan on doing any Umbraco content reconfiguration such as creating new doc types, creating a new language section or redefining content structure do it locally! Install SQL Server Management Studio and setup a SQL server on your machine. Then obtain a bacpac of your database from Azure and deploy it to your local SQL server. Do all your Umbraco configuration changes on that local database and then deploy a new instance of your database to Azure. Switch the web app to use that new database and then delete the old one. You save on paying the Pay as You Go transaction fees by moving things around in a local database compared to one in Azure. There is also a limit on resources for each tier and you could end up bottle-necking the database from too many transactions between Umbraco and the database.

Using Umbraco just as an editor (we go off topic here!)

This method removes Umbraco out of the equation all together, hear me out. You could run Umbraco locally on your machine, write your content and then view it locally. Then scrape the HTML output and upload the HTML to the web app or a server running linux. This removes the need for Umbraco and any unknown security vulnerabilities it may have... You also save on Pay as You Go fees as the web app is just serving static HTML which isn't too difficult and you no longer need a database in Azure! Essentially Umbraco becomes a bespoke content editor for yourself.

So Matt what are your current costs for Azure?

Database

My last invoice from 18th December 2019 to 17th January 2020, I paid £7.20. The period before that it was £7.45, however I am not sure how but I managed to run a SQL azure database for free, despite it saying my trial has ran out.

I was never upgraded to basic, a lucky win for me but you might not be so lucky. Basic is only estimated to cost £3.72 a month so its not a huge problem.

Since moving to Umbraco 8 I needed to create a new database and I needed more space so now I am running Basic, hello £3.72! Bringing my costs closer to £10 a month. However that is not the case yet... From Jan to Feb 2020 I only reached a cost of £8.92.

I expect the price to rise as I TRY to write more content this year! Remember Azure is a Pay As You Go service so the more time you spend in the back office writing content the more request being sent directly to the web app and database meaning more usage charges. You can get around this by writing your content in word or google docs and then pasting the content into Umbraco and publishing in one go. That's if you are really trying to mitigate any extra unnecessary cost.

Web App

Again, since I need a custom domain name I had to get a paid ASP, I am currently using D1:shared which allows me to have a custom domain name but no HTTPS support, which is a shame but luckily Cloudflare is free to bare the burden. You are also given 1GB of disk storage too which if you are a small blog you could get by with. D1 is estimated to cost about £7.07 a month however in my case it can go over slightly. To the right you are seeing the cost of Azure with the database at basic scale so far its only added an extra £0.20 but I expect a bigger charge after finishing off this post!

One thing I will mention is DO NOT go for the B1 tier. It says £51.14 estimated however in my case it took me to the full £50 charge for the App Service, you then pay tax on top of that so I ended up paying £61.87 for a single month!

I made that mistake so you don't have too.

You made it!

I hope this post has given you an idea on what Azure can offer for your future blog and a greater idea on how much it could cost to run Umbraco using the bare-bones of Azure. There is an ongoing effort to move Umbraco to .Net Core which could mean Umbraco running in Linux? This opens more options to consider if that becomes a reality!