Let’s be honest; Microsoft Azure is a playground for the more technically savvy crowd. In our previous post, we discussed website hosting and the related costs associated with it. While Microsoft Azure may be an affordable option, the ease of use and the challenging steps for deployment will likely be off-putting for you.
With that said, you’ll find the instructions to create or ‘map’ a custom domain below along with a full explanation of things to consider and what is available to you.
Hint: If you still need help getting started with hosting your website and uploading your content, see our last article for full details.
Domain Names on Azure: The Fine Print
Creating Your Website’s Custom Domain in Microsoft Azure is an important step in keeping your website accessible. If you’ve already set up your website, you may have noticed that the URL is quite unfriendly. While you can create your website’s custom domain in Microsoft Azure, you should know two things to consider:
First, you can only map subdomainsto the Microsoft Azure static website endpoint (for example, www.example.ba will work, while mapping a root domain example.ba will not work ). Though there are workarounds for that also, keep reading.
Second, if you want to serve yourwebsite over SSL(Secure Sockets Layer, the encryption protocol that keeps your internet connection secure),you have to use the Azure CDN (Content Delivery Network). Though it isn’t free, Azure CDN’s pricing starts at $0.081 per GB (outbound transfer), which is still a very affordable option considering that static websites are really small.
If neither of these considerations is a gamechanger, continue reading for instructions on setting up your custom domain name.
How to Map Your Custom Domain Name
To start creating your website’s custom domain in Microsoft Azure (for HTTP-only access), follow these steps:
Take your Azure Storage Static Website Primary Endpoint link and remove the https:// and the trailing / from it.
I.E. https://kdstaticwebsite.z1.web.core.windows.net/ becomes kdstaticwebsite.z1.web.core.windows.net
Go to your Domain registrar or your domain NameServer hosting provider, such as GoDaddy, and create a CNAME record to point to your Azure static website endpoint host name.
A CNAME record is a type of DNS (domain name system server) record that maps a source domain name to a destination domain name, I.E., customdomain.com and www.customdomain.com would send you to the same website.
Create a CNAME under your desired custom Domain.
I will create a kdstatic.staging.staging.networkantics.com CNAME (the subdomain is required, root domains are not supported) pointing to the A record (A record is our stripped Azure Storage Static Website Primary endpoint link) kdstaticwebsite.z1.web.core.windows.net
Go to Azure portal -> Static website Azure storage account.
Under Security + networking, select Networking.
Switch to the Custom domain tab at the top as seen in the image below.
Under Domain name, type in the CNAME domain record you created before.
Click on Save. Your domain is verified.
Navigate to Storage Account’s Settings -> Configuration.
Set Secure transfer required to Disabled.
Navigate to the target domain and please your eyes with the sight of your static website!