Setup Azure storage account for static websites
In this blog we will learn how setup an Azure Storage Account for static website usage and what the limitations of Azure storage accounts for static websites are.
This is a multi part article with the following parts:
- Part 1 - Static site generators
- Part 2 - Setup Azure Storage Account for static websites
- Part 3 - Setup Azure DNS for static websites
- Part 4 - Configure Azure CDN for static websites
- Part 5 - Configure Azure Function App for root domain redirection
- Part 6 - Setup Azure DevOps CI/CD pipeline for static websites
In this part we will take a look at the required Microsoft Azure services for static website hosting and setup the storage account as main part of our website backend.
For the setup, we will be using Azure CLI in Azure Cloud shell. That is the easiest way and it enables us to work completely from our browser. We already created a resourcegroup called
staticwebsitedemo, where all resources needed for our website are located.
We will use the following Azure services:
|Storage Account||We will use the “static website” feature of Azure storage accounts to host our website.||Custom SSL certificate/domain not supported|
|CDN Verizon||We will use the verizon CDN for caching, redirecting and (free!) SSL certificates.||We use the “Premium Verizon” tier to have the rules engine available|
|DNS Zone||We will use the DNS zone to host all necessary DNS records of the site.||We need to use a workaround for CNAME apex records for CDN validation|
|Function App||Used for redirection from root domain to subdomain www.||Workaround, as root domains can currently not be added to a CDN endpoint|
At first, we will setup the storage account name
staticsitedemo for our test blog:
Next we need to enable the static website feature on the created storage account:
We have now created the complete hosting backend for our static website. We could already start using it by uploading files into the
$web container and visiting the above shown url
But as already described in the overview table, there are several limitation that we need to tackle:
- Storage Accounts support HTTPS but not for custom domains. A custom domain could be added to the storage account, but HTTPS will not work with it.
- Storage Accounts don’t support HTTP to HTTPS forwarding
- Storage Account don’t support caching
- Storage accounts don’t support PFS
We will implement all listed features in the following parts using only Azure services.
See the next part to learn about how to migrate your DNS zone to Azure and how to configure it for custom domain usage with your static site.