Azure Virtual Machine Custom domain using Azure DNS Zone

August 07, 2018 by Anuraj

Azure VM Azure DNS Azure

This post is about how to use custom domain name for Azure VM using Azure DNS. A DNS zone is used to host the DNS records for a particular domain. Azure DNS allows you to host your DNS zone and manage your DNS records, and provides name servers that will respond to DNS queries from end users with the DNS records that you create.

When you create an Azure VM and tried to configure DNS name, Azure will prompt you to use Azure DNS if you want to use custom domain name. So first you need to create Azure DNS. You can use your domain name as the name for DNS Zone.

Create Azure DNS Zone

Once you created the DNS Zone, you will be able to find the Azure Name Servers, which you need to update to your domain provider name server entries.

Azure DNS - Name Server Details

Once you do that, you can check it is updated or not using nslookup command, like this. - nslookup -type=SOA contoso.net, which will display results something like this.

DNS Lookup command results

Now you have configured the DNS Zone properly. To map the URL to the IP Address, you need to add the two record sets to the DNS Zone.

Add Record Set

You need to add @ and * with type A and point to the VM’s IP Address. Here is the final output.

Adding Record Set

This way you can use the Azure DNS Zone to map custom URL to Azure Virtual Machines.

Happy Programming :)

Copyright © 2024 Anuraj. Blog content licensed under the Creative Commons CC BY 2.5 | Unless otherwise stated or granted, code samples licensed under the MIT license. This is a personal blog. The opinions expressed here represent my own and not those of my employer. Powered by Jekyll. Hosted with ❤ by GitHub