Fix Azure Virtual Network Dns Zone Errors
When working with Azure Virtual Network, you may encounter a configuration error that prevents your deployment from working. This guide explains the most common mistake with dns zone and shows the exact fix.
A Common Mistake
Not configuring a custom DNS zone for a VNet, relying on Azure default DNS which cannot resolve private endpoints or custom domains.
The incorrect command:
# Default Azure DNS
az vm create --name my-vm --resource-group my-rg --vnet-name my-vnet --subnet my-subnet
Error output:
VM created with default Azure DNS.
NSLookup mystorage.blob.core.windows.net
Returns public IP (104.16.x.x)
Private endpoint does not work because DNS resolves to public IP. Custom domains (app.internal.example.com) cannot be resolved.
The Correct Approach
The right way to configure dns zone in Azure Virtual Network:
az network private-dns zone create --name privatelink.blob.core.windows.net --resource-group my-rg
az network private-dns link vnet create --zone-name privatelink.blob.core.windows.net --name my-link --virtual-network my-vnet --resource-group my-rg --registration-enabled false
az network private-dns record-set a create --name mystorage --zone-name privatelink.blob.core.windows.net --resource-group my-rg
az network private-dns record-set a add-record --record-set-name mystorage --zone-name privatelink.blob.core.windows.net --resource-group my-rg --ipv4-address 10.100.1.10
Successful result:
Custom DNS zone created.
nslookup mystorage.blob.core.windows.net
Returns: 10.100.1.10 (private IP)
All services with Private Link resolve to private IPs. Custom internal domains work correctly.
How to Prevent This
Use Azure Private DNS zones for Private Link resolution. Auto-link zones to VNets. Azure Private DNS supports auto-registration for VMs. Use custom DNS servers for hybrid scenarios. Plan DNS hierarchy carefully for multi-region deployments.
FAQ
Built by the developers of Doda Browser, DodaZIP, and Durga Antivirus Pro. Secure your cloud with DodaTech.
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro