Using Private DNS Zones for Custom Domains in Azure …

Aamod Kadam
3 min readJan 29, 2024

--

Working with Azure Private DNS Zone

What is Azure Private DNS Zone ?

Private DNS zone resolves the DNS queries within virtual network. The DNS records in the DNS zones are not resolvable over the Internet and that is why it is called Private. This is quite handy when you want to use your own domain name within virtual network and that also without any complicated DNS solution.

Typical Flow for using Private DNS Zone

  1. Create Private DNS Zone with required domain name ( e.g. dev.com )
  2. Create Virtual Network
  3. Create link between Private DNS zone and virtual network

Steps 1 and 2 may be done in any order.

Demo Setup

The demo setup contains following.

  1. dev.com private DNS zone
  2. dev vnet
  3. vm1 and vm2 in dev vnet

Step — Test the Setup

  1. Connect to vm1 in dev vnet

2. Try to resolve the DNS names for virtual machines from dev vnet .

nslookup vm1.dev.com

nslookup vm2.dev.com

This does not resolve the domain name !

In order for private DNS zone to be effective it has to be linked with dev vnet.

3. Create Virtual Network link between dev.com private DNS zone and dev vnet

Before virtual network link is created
Note : Add virtual network link with Enable auto registration selected
After the virtual network link is created

4. Try to resolve vm1.dev.com and vm2.dev.com again.

This time it works as it is associated with dev VNET !

If we look at the dev.com private DNS zone then we should see the DNS entries for vm1 and vm2 as shown below. This is added by Azure for us. VMs in the VNET are automatically registered with Private DNS zone based on ‘Auto Registration Enabled’ setting for creating virtual network link.

DNS records for VMs are automatically added in the DNS Zone

Thus Azure Private DNS zone simplifies the DNS management without building your custom DNS solution.There are additional use cases which can be setup by using Private DNS zones such as to resolve multiple domain names (test.com , prod.com ) from multiple networks and integrating it with custom DNS solution, however that is for another post !

--

--

Aamod Kadam
Aamod Kadam

Written by Aamod Kadam

AWS Community Builder | upGrad Course Author | 7 x AWS | Terraform Associate | Cloud Consulting | AWS | Azure | Docker | Kubernetes | Software Architecture