In addition to the many features of Microsoft Azure this platform is really cool for hosting websites, see http://azure.microsoft.com/en-us/services/web-sites/. Since we not only want to reach our websites with the out-of-the-box Microsoft domain *.azurewebsites.net we can add our custom domains as well. This article shows how this works.
Update: See also Manage custom domains in Azure Websites step-by-step
First switch the Azure website to a non-free mode
For using one or more custom domains we need to switch the website to the (non free) web hosting plans Shared, Basic or Standard. You can do this in the “Scale” menu of the specific website. The screenshot shows how.
Don´t forget to save the configuration changes at the bottom. This can take some seconds to about some minute depending on the size of the website(s).
In our sample we´re working with the domain “grom.at” and use an Umbraco web in Azure for the website itstelf. The website is already up and running. After the scale up you get the “manage domains” button in the “Configure” menu.
The DNS part
Usually you don´t know from memory where the custom domain is managed. So first we need to know which is the primary DNS server. Let´s ask!
Open a command line and use
- set type=any
See the whole input and output in this sample:
Default Server: UnKnown
> set type=any
grom.at internet address = 220.127.116.11
grom.at nameserver = ns3.atwork.at
grom.at text = "v=spf1 include:spf.protection.outlook.com -all"
primary name server = ns1.atwork.at
responsible mail addr = webmaster.atwork.at
serial = 3411
refresh = 900 (15 mins)
retry = 600 (10 mins)
expire = 3600 (1 hour)
default TTL = 3600 (1 hour)
grom.at text =
grom.at nameserver = ns1.atwork.at
grom.at MX preference = 10, mail exchanger = grom-at.mail.protection.outlook.com
Now ensure the IP address of the primary nameserver if you are not sure who is responsible for that domain.
ns1.atwork.at internet address = 18.104.22.168
Connect to the DNS server – or if it´s managed at a provider use the DNS panel of the ISP, see below.
Manage the custom domains in the Azure website
Azure helps to configure the custom domain(s). Usually you want to add the domain with leading www. and the domain itself for opening the website. In our sample that´s www.grom.at and grom.at. The domain provided by Azure itself automatically is gromat.azurewebsites.net.
The dialog Manage custom domains checks the domain name while typing and displays a green (OK) or red (error) icon at the line end. The screenshot shows the finished configuration for our scenario.
So we need to configure our DNS zone before we can add these values as host headers in Azure.
The trick with the root domain
It´s obviously we need to follow the steps described in the dialog. The CNAME steps seem to be clear. But we need to map the root domain, too!
To map a root domain (such as grom.at) to an Azure Web Site there´s workaround necessary, see Configuring a custom domain name for an Azure Web Site.
The trick is to map from “@”, or a blank entry to the virtual IP address. To create a wildcard mapping that maps all sub-domains to the virtual IP address, you will usually map from “*” to the virtual IP address. Remember that the specifics of mapping a root or wildcard vary between registrars.
If you´re self responsible for the DNS zone, f.i. in your own Windows DNS-server this is how the zone should look like – see the yellow marked entries. This configuration works.
Point the A-record (HOST) to the IP address given to you by the Azure website. In our case it´s 22.214.171.124. Add a CNAME with the star “*” pointing to the FQN gromat.azurewebsites.net – our Azure website. Finally add a CNAME with the leading “www.” and point it to the Azure website gromat.azurewebsites.net as well.
With these three DNS-entries our website is available with these URLs:
http://grom.at and http://www.grom.at (and of course with http://gromat.azurewebsites.net – but that´s not in our DNS zone…)
After the editing you can increment the serial number of the zone to ensure it´s transferred to the secondary (or more) DNS servers.
Now check the configuration when querying the domain with nslookup (do a DNS flush before or use an other machine). That´s it on the DNS side.
…comes the configuring part in the Azure portal as shown above in the “manage custom domains” dialog. Try to add your custom domain(s) to the Azure website.
Keep in mind that it may take some minutes up to some hours for the new DNS changes to be active.
If everything went well the custom domains should be visible in the the “Configure” page under the section “domain names” like here.
A nice feature is that the custom domain from now on is also used as Site URL in the “Dashboard” of the website.
If you want to use SSL bindings Azure automatically provides the website with the URL https://[websitename].azurewebsites.net like https://gromat.azurewebsites.net.
To use your own custom domain with SSL encryption you need to create your own certificate, upload it and add it to the SSL bindings. Maybe stuff for another blog post…
Test the domains with your website and enjoy the worldwide availability of your Azure website with your custom domains.
Hope this article helps!
See also Manage custom domains in Azure Websites step-by-step