
close
close
There are many ways to host websites in Azure. The newest of these is to store static website code in a special container in a General Purpose v2 (GPv2) storage account. The benefit of this is that you get an ultra-simple configuration and an ultra-low cost. The website code must be static, but backend process execution can be done with Azure platform features such as Functions. If you need dynamic content, then Microsoft recommends you stick with Azure App Services or, if you really need to, virtual machines.
At the most basic level, the cost of hosting will be:
Additional costs might be accrued if you add extra features such as Content Delivery Network (CDN), Functions, and so on.
The infrastructure you require for this hosting is a GPv2 storage account – GPv1 is not supported.
Creating an Azure GPv2 storage account [Image Credit: Aidan Finn]
After the save commits, the URL of the website will appear – document this.
Enabling static website hosting in an Azure storage account [Image Credit: Aidan Finn]
Now you can upload content to the storage account. Once you enable static website hosting, a system container called $web is created in blob storage in the GPv2 storage account. This will be where you store the website. There are many ways to get content into the container:
In my case, I am using the Azure Storage Explorer.
Upload content for a static website in an Azure storage account [Image Credit: Aidan Finn]
Browsing the default website URL [Image Credit: Aidan Finn]
The default URL is not quite user-friendly and most people will need a vanity URL, such as http://petri.com. There are a couple of gotchas.
You might have noticed that the storage account provides HTTPS hosting. Currently, we cannot upload a custom SSL certificate to a storage account to be associated with a vanity domain URL. The only workaround is to abstract the storage account using Azure’s CDN, which will have the added benefit of improving the performance of the website.
The second gotcha is that the static website on the storage account does not have a static public IP address. This means that we cannot create a root vanity domain name (petri.com) and users will have to browse to petri.com.
If you want to use SSL/TLS then you have no choice right now but to use the aforementioned CDN solution. However, if you want to enable insecure browsing (no SSL/TLS) then
You can associate a vanity domain by doing the following:
You will probably have to wait a few minutes for the new name to be usable.
More in Microsoft Azure
Microsoft Dev Box Adds New Features Ahead of its General Availability in July
May 23, 2023 | Laurent Giret
Microsoft's Azure Deployment Environments Service Now Generally Available
May 23, 2023 | Rabia Noureen
Microsoft Fabric Brings New AI-Powered Data Analytics Features to Boost Productivity
May 23, 2023 | Rabia Noureen
Azure Firewall Adds New Logging and Metrics Features to Enhance Traffic Analysis
May 17, 2023 | Rabia Noureen
Most popular on petri