Blog 3: Setting up Azure
Normally, Azure Web App is quite expensive for a static website. But we want to use our own custom domain. Before the Shared Plan (D1) came around, your cheapest option was the B1 plan at about €46/month. The D1 plan changed this, but I think ~€8/month is still a lot for a small static website.
Luckily, because the site is static, we can serve the entire site using CDN, and Azure CDN is a lot cheaper! We can use the Free F1 Azure Web App Plan, and use Azure CDNs low rates/GB1 to publish your site.
Azure Web App
Assuming you already have your Azure account set up, go ahead and create a new Web App.
After your Web App has completed deploying, you can go ahead and create a new CDN, as well as a new CDN Endpoint. Make sure you pick the same Resource Group you used when setting up the Web App.
Deploying the CDN and the CDN endpoint can take some time, especially provisioning the CDN endpoint to every POP. But luckily, we can continue while waiting on this.
Open your newly deployed CDN, and click on the newly created CDN endpoint in the Overview blade. Take note of Endpoint hostname and create a CNAME record for your domain to this hostname2.
Then click on Custom domains in the left menu, followed by the + Custom domain button in the new blade.
Choose your endpoint name, then enter your custom domain name. Azure will check if the CNAME record is present, so if you get a red exclamation mark, try again later. When it has the green tick, click on Add.
Custom HTTPS (optional)
After the custom domain is deployed, click on the Custom Domain you just added. On the next page, switch the toggle to On. You can let Azure provision a certificate for you, or use your own certificate (which will be stored in your Azure Key Vault). I chose the former and clicked Save.
This process can take a serious amount of time! The domain validation step (during which Azure will check if the CNAME record is directly mapped to the endpoint, else it will send an email to the Registrant in WHOIS). On several occassions, this process took between 12 hours and 4 days for me.
After that, you can navigate to https://your.customdomain.tld/ and see the Azure default index in all it’s HTTPS glory.
Coming up next: creating the pipeline
In the next blog, we will use Visual Studio Team Services to set up the remote repository for our site, build agent tasks, and automation to build our site, deploy it and purge the CDN on every
commit new post.