Skip to main content
Private DNS zones enable DNS name resolution for resources using private IP addresses in Azure. This article explains the concept, shows a hands-on demo (portal + Azure CLI), and walks through validating cross-VNet name resolution from Linux VMs by creating a Private DNS zone and linking virtual networks. What you’ll learn
  • What an Azure Private DNS zone is and how it differs from network connectivity
  • How to create a Private DNS zone in the Azure portal
  • How to link virtual networks and enable auto-registration
  • How to validate name resolution from Linux VMs (nslookup)
  • CLI commands to create a quick test VM
Why use Private DNS zones
  • Enable resolution of hostnames across VNets without exposing records to the public internet
  • Centralize private DNS records (e.g., *.internal.company.com) for multiple VNets
  • Integrates with Azure services such as Azure Private Link
Consider the following diagram:
A diagram titled "Private DNS Zones" showing a table that maps VM names (vm-01 to vm-06) to IP addresses under a private DNS zone. To the right are two VNets (vnet-a 10.0.0.0/24 and vnet-b 10.1.0.0/24) with their VMs, and a red X marking a failed link/DNS resolution between vm-03 and vm-06.
Diagram explanation
  • VNet A and VNet B are separate VNets with their own address spaces and internal DNS domains.
  • By default, VMs in the same VNet can resolve each other’s hostnames (for example, vm-01 → vm-02).
  • To resolve hostnames across VNets (for example, vm-01 → vm-06), create a Private DNS zone (for example, kodekloud-int.com) and add virtual network links to that zone.
  • Virtual network links make a VNet aware of a Private DNS zone. Optionally enable auto-registration so Azure automatically creates A records for VMs in the linked VNet.
  • Important: Private DNS zones only provide DNS name resolution — they do not provide network connectivity. To enable traffic flow between VNets, configure VNet peering or VPN/gateway connectivity.
Private DNS zones enable private name resolution across VNets when linked, but they do not change network connectivity. Use VNet peering or VPN/gateways to enable traffic between VNets. Auto-registration only works when VMs use Azure DNS and have the VM agent/network settings that allow registration.

Portal: create a Private DNS zone

Steps (brief)
  1. In the Azure portal, search for Private DNS zones and click Create.
  2. Enter the DNS zone name (e.g., kodekloud-int.com) and select a subscription and resource group.
  3. Create the zone. Note that Private DNS zones are global resources — you do not choose a region.
Example portal screenshot:
A Microsoft Azure portal screenshot showing the "Create Private DNS zone" form, with subscription and resource group selected and the DNS name "kodekloud-internal.com" entered.

Reusing existing VMs for the demo

For the demo we use existing Linux workload VMs. The Virtual Machines blade lets you view VM names, sizes, and public/private IP addresses.
A Microsoft Azure portal screenshot showing the "Virtual machines" page. It lists several running Linux VMs with their names, locations, sizes and public IP addresses.

Inspect the Linux VM DNS configuration and test resolution

  1. SSH to a workload VM and inspect resolver configuration (Ubuntu often uses systemd-resolved with a local stub resolver at 127.0.0.53).
Example SSH:
Check the local resolver:
nslookup for a VM in the same VNet (successful):
nslookup for a VM not in the VNet (failure before linking):

Create a temporary VM for testing (Azure CLI)

If you need a VM in a separate resource group/VNet for the demo, use the Azure CLI. Example commands and trimmed responses: Set subscription and create a resource group:
Sample JSON response (trimmed):
Create the VM:
Sample trimmed response:
At this point, the VM is running in a different VNet (or outside the workload VNet) and will not resolve by short hostname until a Private DNS zone is created and VNets are linked.
A virtual network link associates a VNet with a Private DNS zone. Links are created per VNet — not per VM — and you can enable auto-registration to populate A records automatically. Portal steps
  1. Open the Private DNS zone (e.g., kodekloud-int.com).
  2. Click Virtual network links → Add.
  3. Provide a link name, select the VNet to link, and enable Auto registration if desired.
  4. Repeat for each VNet to be able to resolve names in the zone.
Auto-registration requirements Notes
  • The link name is for administration only.
  • Auto-registration creates A records for VMs in the linked VNet. If auto-registration is disabled, create A records manually or configure DNS forwarding.

Validate cross-VNet resolution

Before linking (failure):
After linking and auto-registration (success using FQDN in the private DNS zone):
Tips for resolution troubleshooting
  • Verify the Private DNS zone shows the expected A records (Private DNS zone → Overview / Records).
  • Confirm VNets are linked and show a successful link status in the Private DNS zone blade.
  • Ensure VMs use Azure DNS or configure DNS forwarding to Azure.
  • Remember: DNS resolution succeeds only if the zone/records exist and the querying VM can reach the DNS service (network connectivity still required separately).

Quick reference: Private DNS zone vs network connectivity


Recap

  • Private DNS zones enable private DNS resolution across VNets when you create virtual network links.
  • Enable auto-registration to automatically populate A records for eligible VMs (Azure DNS + VM agent).
  • Private DNS zones do not create network links — use VNet peering or VPN/gateway solutions to enable traffic.
  • Common usage includes service isolation, internal-only hostnames, and Azure Private Link integrations.
That concludes this lesson on Azure Private DNS zones and cross-VNet name resolution.

Watch Video