Using Microsoft Azure’s DNS service for your public domain name is pretty easy to setup and cost effective if your web hosting provider doesn’t provide or allow you to modify DNS zone data; or if you’re hosting your web applications on Azure it makes sense to use the Azure DNS service as well.
Azure DNS is currently less than $1 per zone per month, and less than $1 per million queries. Seems cheap to me.
There are a few key parts to getting this going:
- Create a DNS zone
- Create DNS records in the new zone that point to your web-hosting server
- Modify your domain name registrar’s Name Server settings to point to Azure (to ensure lookups are performed on your newly created zone)
First, login to the Microsoft Azure portal, click New and navigate to Networking and click on DNS zone.
Enter you domain name as the Name (without www. or http://) and optionally create a new Resource group, or use an existing one. A resource group is a logical container for resources – if you’re running an Azure based website, then it might be worth re-using your existing resource group. But you won’t break anything by creating a new Resource group if you’re not sure.
Once your new DNS zone is setup, navigate to the DNS zone resource and click on the new zone name (hkeylocalmachine.com, in blue text in this example).
You’ll notice that there are two records created automatically for you. You will need at least 1 more record, but we’ll create two for completeness sake. Click on the +Record set link.
The first record should be an A record with the name entered as simply the @ symbol. The IP address here needs to be that of you web-hosting server (do not use 18.104.22.168 like I have). Ie; if your website is currently available at http://22.214.171.124 from your web browser, then that’s the IP address you would enter here.
Repeat the previous step and add an additional A record. This time, give it the name www and again point it to the same IP address as your web-hosting server. This way, when someone requests yourdomainname.com or www.yourdomainname.com – both will return the same IP address.
Your DNS zone should look something like this:
The setup of the DNS zone is complete. There are usually more records you might create or need, but for this simple example we’ll leave it there.
The last step is modify your domain name registrar’s settings. For that you will need the Azure Name Server details, which are located in the Overview section for your newly created zone.
NOTE: These name server addresses are not the same for every Azure zone you create. If you create another zone in the future, it is likely to have different name server addresses.
In my example, I’m using GoDaddy as my domain name registrar, though the steps for your registrar will be similar. Simply login to their online portal, find the option to manage Name Server settings, and select any available option to use your own name servers (with GoDaddy, it’s the Custom name server option).
Enter in all 4 of the name servers you got from the Azure portal and save.
NOTE: The name server addresses provided by the Azure Portal have a trailling dot (‘.’) at the end of the names – you need to make sure you don’t have that last ‘.’ when you enter it into your domain name registrar settings.
That’s it. Once DNS replication is complete (anywhere from 5 minutes to 24 hours) your new DNS zone should be in full swing.
To confirm all is correct, perform an nslookup of your domain name from the command line, and it should return the correct IP address of your web-hosting server: