It is possible to host a small (less than 1 GB) static website with a custom domain name and SSL access, for pennies a month, from Azure Blob Storage and using Azure CDN!
This blog post outlines the first 6 steps for setting up a static website within an Azure GPv2 storage account. SSL and custom domain name are provided via an endpoint to the storage account from Azure CDN. While a custom domain name could be assigned to the new static website at the storage account level, we need to use Azure Content Delivery Network (CDN) to provide the https functionality/security, so the website’s custom domain will be pointed to the CDN endpoint.
Some of the key attributes of the custom HTTPS feature are:
- No additional cost: There are no costs for certificate acquisition or renewal and no additional cost for HTTPS traffic. You pay only for GB egress from the CDN.
- Simple enablement: One-click provisioning is available from the Azure portal. You can also use REST API or other developer tools to enable the feature.
- Complete certificate management is available: All certificate procurement and management is handled for you. Certificates are automatically provisioned and renewed prior to expiration, which removes the risks of service interruption due to a certificate expiring.
– Microsoft Docs: Tutorial: Configure HTTPS on an Azure CDN custom domain
1. Create a GPv2 Azure storage account
2. Enable the Static Website feature of the new storage account
3. Copy the static website’s files into the storage account using Storage Explorer
4. Verify web access to storage account files
5. Set Public Access Level of $web container
6. Add a Custom Domain to an Azure Storage Account
7. Create an Azure Content Delivery Network (CDN)
8. Create an Azure CDN endpoint
9. Migrate a custom domain name to the CDN endpoint
10. Add HTTP Rules to an Azure CDN
1. Create a GPv2 Azure Storage Account:
2. Enable the Static Website feature of the new storage account:
- Go to Settings > Static website > select Enabled > add in the file name of the static site’s landing page and an error page > Save
- Enabling the Static website feature creates a $web container within the storage account’s blob containers for the static website’s files.
- Note also the Primary endpoint provided for web access to the $web container’s contents.
- Copy and paste this Primary endpoint to be used later in setting up the CDN access to the static website’s files (This Primary Endpoint MUST be used when creating the CDN endpoint in Step #, or the final custom domain https functioning will NOT resolve. Read here for discussion on this error.)
- The new $web container as seen in Storage Explorer:
3. Copy the static website’s files into the storage account using Storage Explorer:
4. Verify web access to storage account files using the saved Primary Endpoint in Step 2 above:
5. Set Public Access Level of $web container:
- Set the storage account container to allow public access since the added Azure CDN will be caching public content of the website in a public container
- Storage Account > Blob > select $web container > Change access level > select Blob or Container > OK
Continuing Steps to Setting up a custom domain website being hosted from an Azure storage account: