Since we often create Azure Websites I want to show a step-by-step guide how to use custom domains with your Azure Website. In my case I´m using the ISP GoDaddy.com and their web-interface and the Azure portal.
To use custom domains see also our previous post Manage custom domains in Azure websites.
So I want to add the custom domain office365conference.net to an Azure website with an Umbraco web (this CMS can handle multiple-domains). We already created the website with the Azure website-URL office365pillscall4papers.azurewebsites.net - sorry, I didn´t have a shorter one .
Basically each Azure Website is accessible with <yourweb>.azurewebsites.net. We now add our custom domain(s) to that website.
Open the portals
First, login at www.godaddy.com and the Azure portal (or in future at https://portal.azure.com).
Currently the GoDaddy portal sometimes adds records with the wrong type, so we came along to use the "classic" Zone File Editor - interface https://dns.godaddy.com/Default.aspx which works perfectly.
We can switch to the "classic DNS manager" in the domain interface (see the link in the blue line) - or with the URL above.
Cleanup the DNS zone file
First of all we want to delete all unnecessary entries (we don´t use email at this time with that domain). like in this screenshot:
..and "Save Zone File".
Confirm the dialog "Your changes have been submitted. These changes usually take 1 hour...". We know that...
On the Azure side
Ok, now switch to the Azure portal, click on the website and go to configure menu.
In here open "manage domains".
We need to add some DNS entries based on the information in the website configuration.
(Here there are already some custom domains existing.)
DNS entry #1: www
Create a CNAME entry www.<yourdomain>.com to <yourweb>.azurewebsites.net.
So click the pencil icon in the line of the CNAME entry of "www" and add your Azure domain.
Then click "Save Zone File".
When this is done, in the Azure website configuration we should add the www entry, here www.office365conference.net. It should work and a small green ok icon at the end of the textbox should appear - and the black checkmark and delete icons at the right side.
If the DNS query works, the host header is updated to the website.
DNS entry #2: awverify
Now we want to use the custom domain without www - with the root domain. For that we need to add the awverify entry to show that the custom domain is ours. We do this by adding another CNAME entry like here:
awverify.<yourdomain>.com to awverify.<yourweb>.azurewebsites.net
In our case: awverify.office365conference.net to awverify.office365pillscall4papers.azurewebsites.net
So we in the CNAME section we click "Quick Add" and type in the DNS infos fo the subdomain with "awverify".
...and finally the root entry itself.
DNS entry #3: Root
We change the A-record and point it to the IP address the Azure portal provides us.
So I edit the "@" Host entry with the pencil icon.
@ to <yourIP>
...and change it to (in our case, see the following screenshot) 18.104.22.168.
So we do this DNS-pointing to the IP address and "Save Zone File":
The finished DNS Zone file
So the whole DNS Zone looks like here: 3 entries pointing to the Azure Website.
That´s it on the DNS panel.
Custom root domain in Azure website
Now we need to add our custom domain with the www subdomain in Azure.
In our sample that´s: office365conference.net
And that´s it. All host headers should now work. In my sample there are several of them.
If everything works, your website should be accessible with both URLs:
- (... and the ones already existing before of course ...)
If your website or CMS can manage multiple host header names, don´t forget to configure them in the backend. In my case I added them to the corresponding nodes in Umbraco CMS.
So if an URL with one of the known hst header names are coming in, the CMS knows which node and which page has to be shown.
...to my colleague Martina Grom for the tips!
See also our blogpost Manage custom domains in Azure websites.
Happy managing your Azure webs and custom domains!