Mastering Azure DNS Solutions - Part 1 - Private DNS

Using Azure Private DNS resolution within Azure.

In modern cloud architectures, name resolution plays a critical role in connecting services reliably and securely. Traditionally, managing DNS within private networks required manual configuration of DNS servers, zone files, and integration across environments. Azure Private DNS offers a native solution to this challenge, delivering a simple, scalable, and highly available service for private DNS management without the complexity of deploying and maintaining custom DNS infrastructure.

In this post, we’ll introduce Azure Private DNS, explain its core capabilities, walk through a real-world deployment example, and share best practices to help you get the most from this essential Azure networking service.

What is Azure Private DNS?

Azure Private DNS enables you to host DNS zones within your virtual networks without exposing them to the internet. This service provides:

  • Private Name Resolution: Devices within virtual networks (VNets) can resolve domain names to internal IP addresses without needing internet-based DNS queries.
  • Zone Linking: You can link Private DNS zones across multiple VNets, allowing shared name resolution without redundant zone management.
  • Record Management: Easily manage A, AAAA, PTR, CNAME, and other DNS record types directly through the Azure Portal, CLI, PowerShell, or ARM/Bicep templates.

By using Private DNS, you avoid the operational overhead of deploying custom DNS servers, while benefiting from Azure’s built-in redundancy, scalability, and security.

Common Use Cases

Azure Private DNS is an essential service in scenarios such as:

  • Hybrid Cloud Deployments: Resolve Azure resources by hostname from on-premises networks via VPN or ExpressRoute with Private DNS Zones.
  • Multi-VNet Architectures: Centralize DNS management across hub-and-spoke network topologies by linking zones to multiple VNets.
  • Service Discovery: Enable internal applications and services to discover each other by friendly DNS names without requiring public DNS records.
  • Secure DNS Operations: Ensure name resolution remains private within your organization’s network perimeter.

Visualizing Private DNS Resolution

To better understand how DNS resolution flows once a Private DNS Zone is linked to a Virtual Network, here’s a simple architecture diagram:

flowchart TB subgraph Azure VNet ["Azure Virtual Network (myVnet)"] VM1["VM1 (10.0.0.4)"] VM2["VM2 (10.0.0.5)"] end subgraph PrivateDNS ["Azure Private DNS Zone (private.contoso.com)"] RecordA1["A Record: app.private.contoso.com -> 10.0.0.4"] RecordA2["A Record: db.private.contoso.com -> 10.0.0.5"] end VM1 -- "DNS Query: app.private.contoso.com" --> PrivateDNS VM2 -- "DNS Query: db.private.contoso.com" --> PrivateDNS PrivateDNS --> VM1["Response: 10.0.0.4"] PrivateDNS --> VM2["Response: 10.0.0.5"]

Let’s walk through a simple example:
We’ll create a Private DNS Zone named private.contoso.com and link it to an existing Virtual Network myVnet in the Azure Portal.

Step 1: Create a Private DNS Zone

  1. Sign in to the Azure Portal.
  2. Search for Private DNS Zones and select + Create.
  3. Enter:
    • Subscription: Select your subscription.
    • Resource Group: Choose or create a new resource group.
    • Name: private.contoso.com
  4. Click Review + Create, then Create.
  1. Once the zone is created, open it and select Virtual Network Links > + Add.
  2. Provide:
    • Link Name: myVnetLink
    • Subscription: Same as your VNet.
    • Virtual Network: Select myVnet.
    • Enable auto registration: (Optional) Turn on if you want VMs in the VNet to automatically register their DNS records.
  3. Click OK to create the link.

Step 3: Add DNS Records (Optional)

  • Within the Private DNS Zone, you can now add records such as A records pointing internal services to private IPs.

Deploying the Same Setup with Bicep

If you prefer Infrastructure as Code (IaC), here’s the equivalent Bicep code:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Parameters
@description('Name of the Private DNS Zone')
param dnsZoneName string = 'private.contoso.com'

@description('Resource Deployment Location')
param location string = resourceGroup().location

@description('Virtual Network Name')
param virtualNetworkName string = 'MyVNet'

@description('Virtual Network Resource Group Name')
param virtualNetworkResourceGroup string = 'MyVNETResourceGroup'

// Get the existing Virtual Network resource
resource vnet 'Microsoft.Network/virtualNetworks@2024-05-01' existing = {
  name: virtualNetworkName
  scope: resourceGroup(virtualNetworkResourceGroup)
}

// Create a Private DNS Zone
resource privateDnsZone 'Microsoft.Network/privateDnsZones@2024-06-01' = {
  name: dnsZoneName
  location: location
}

// Create a Virtual Network Link for the Private DNS Zone
resource vnetLink 'Microsoft.Network/privateDnsZones/virtualNetworkLinks@2024-06-01' = {
  parent: privateDnsZone
  name: '${privateDnsZone.name}-vnetLink'
  properties: {
    virtualNetwork: {
      id: vnet.id
    }
    registrationEnabled: true // Set to false if auto-registration is not needed
  }
}
ℹ️
Customize registrationEnabled: true if you want automatic VM DNS record registration.

Best Practices for Azure Private DNS

  • Plan your DNS hierarchy carefully: Avoid conflicts by segmenting zone names logically across environments (dev, test, prod).
  • Use auto-registration strategically: Enable it on VNets where VM lifecycles are dynamic, but disable it where strict record control is needed.
  • Leverage Role-Based Access Control (RBAC): Protect DNS zones and record management operations using Azure RBAC policies.
  • Monitor DNS metrics: Use Azure Monitor to track DNS query volumes, error rates, and performance.
  • Integrate with hybrid environments thoughtfully: When integrating with on-premises DNS, consider using Azure DNS Private Resolver for bi-directional resolution.

Learn More