Azure Private DNS in Simple terms with a Demo
Explaining Azure Private DNS zone and its usage
What is a DNS?
Every website has a domain name and an IP address linked with it. A Domain Name System(DNS) contains this info. It is also called as a phonebook of the internet. We use domain names because its easy to remember and has some other benefits.
Azure Private DNS zones vs. DNS Zones
We have two services in Azure for domain name resolution.
A DNS Zone is mainly used for internet-facing domain names.For example, the domain ‘contoso.com’ may contain several DNS records, such as ‘mail.contoso.com’ (for a mail server) and ‘www.contoso.com' (for a web site).
A Private DNS Zone is used to provide DNS service for your virtual network. It means virtual machines in a network can be given custom domain names. No need to configure custom DNS solution seperately.
DEMO
1. Creating a private DNS zone
As you can see, we have given a custom domain name “private.abc.com”
2. Create a virtual network and link it to a private DNS zone
Here, we created a virtual network vnet1 in eastus region in same resource group DNS-Demo-rg
Go to the private dns zone and create link to the virtual network. Enable auto registration so that it automatically creates dns records.
3. Create resources in the linked virtual network
I am creating two virtual machines with ubuntu os. Make sure to choose the virtual network which is linked to the private dns zone.
After creating two virtual machines, go check the private dns zone.
From above picture, two records of type A have beed created for the two virtual machines. Now you can use the private dns for you purposes.
From VM v1, we are pinging v2 using its private domain
Use nslookup
The above VM’s have two domains. One is the private one that we have created. And the other is default FQDN(internal.cloudapp.net) provided by azure.
Hope you get clarity about Private DNS Zone.