CICD blog with Azure and Hugo - Part 3
Aug 7, 2018
3 minute read

Previous blogs in this series:
1. Pipeline overview
2. Creating your site

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.

Azure Web App Creation

Azure CDN

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.

Azure CDN Creation

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.

Custom domain

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.

Adding a Custom Domain

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.

Setting the Custom Domain

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.

Blogs in this series:
1. Pipeline overview
2. Creating your site
3. Setting up Azure
4. Creating the pipeline

  1. even 50% cheaper when you use Microsofts own CDN during the public preview [return]
  2. note, you can’t set a CNAME record on the domain root. Most registrars provide Forwarding services (my site is using this) so you can forward mycustomdomain.tld to www.mycustomdomain.tld. [return]