Symptoms
- Many VMs in one VNet (or every spoke that uses the same DNS servers) fail at the same time: domain logons fail, apps can't reach databases or private endpoints by name,
apt/yum/Windows Update fail. nslookupon a VM times out (DNS request timed out,connection timed out; no servers could be reached) or answers from the wrong server.- Connections by IP still work. That is the giveaway that this is DNS, not routing.
- The activity log shows
Microsoft.Network/virtualNetworks/writeor a NIC update shortly before the incident, or the DNS server VMs were patched, resized or deallocated.
1. Confirm scope and impact (5 minutes)
From an affected VM:
# Windows
Get-DnsClientServerAddress -AddressFamily IPv4 | Where-Object ServerAddresses
Resolve-DnsName login.microsoftonline.com
Resolve-DnsName mydb.privatelink.database.windows.net
Test-NetConnection 10.0.0.4 -Port 53
# Linux (systemd-resolved)
resolvectl status | grep -A2 "DNS Servers"
dig +time=2 login.microsoftonline.com
dig @168.63.129.16 +time=2 login.microsoftonline.com # Azure-provided DNS, bypassing custom servers
| Result | Meaning |
|---|---|
| VM points at the expected servers, they time out | DNS server VMs down or blocked (NSG, firewall, UDR) |
| VM points at unexpected IPs | VNet or NIC DNS setting was changed |
Custom servers answer public names, fail privatelink names | Forwarders lost their path to 168.63.129.16 or the Private Resolver |
@168.63.129.16 works, custom servers don't | The problem is the custom DNS tier, not Azure |
Then look at the configured setting and recent changes:
az network vnet show -g rg-hub -n vnet-spoke-app --query "dhcpOptions.dnsServers" -o tsv
az monitor activity-log list -g rg-hub --offset 6h \
--query "[?contains(operationName.value,'virtualNetworks/write') || contains(operationName.value,'networkInterfaces/write')].{time:eventTimestamp, op:operationName.value, caller:caller, res:resourceId}" -o table
NIC-level DNS overrides the VNet setting. Check whether any NICs have their own:
az network nic list -g rg-app --query "[?dnsSettings.dnsServers[0]!=null].{nic:name, dns:dnsSettings.dnsServers}" -o table
2. Fix the DNS servers themselves
If the setting is correct but the servers don't answer, fix the DNS tier first. Changing the VNet setting won't help VMs that can't renew yet.
# Are the DNS server VMs running?
az vm list -d -g rg-identity --query "[].{name:name, power:powerState, ip:privateIps}" -o table
az vm start -g rg-identity -n dc01 --no-wait
# Is port 53 allowed? Check effective NSG rules on the DNS server NIC
az network nic list-effective-nsg -g rg-identity -n dc01-nic -o json
On a Windows DNS server, check the service and forwarders:
Get-Service DNS
Get-DnsServerForwarder
Resolve-DnsName mydb.privatelink.database.windows.net -Server 168.63.129.16
Tip
For private endpoint names, your custom DNS servers must forward the
privatelink.*zones (or everything) to 168.63.129.16 or to an Azure DNS Private Resolver inbound endpoint, from a VM inside a VNet linked to the private DNS zones.
3. Restore the VNet setting
If someone changed the setting, put back the previous list. Get it from the activity log change details or your IaC:
az network vnet update -g rg-hub -n vnet-spoke-app --dns-servers 10.0.0.4 10.0.0.5
To go back to Azure-provided DNS, set DNS servers > Default (Azure-provided) on the virtual network in the portal, or remove the setting in your Bicep/Terraform and redeploy.
Warning
Pointing domain-joined VMs at Azure-provided DNS fixes internet and private endpoint names but breaks AD (domain controller SRV records, Kerberos). Only do it for VNets with no domain dependency.
4. Push the setting to VMs
VMs keep using the old DNS servers until they renew their DHCP lease or restart. Renew in place first; it avoids a reboot storm.
Use Run Command in batches, so you don't need a working logon path:
# Windows VMs
for vm in $(az vm list -g rg-app --query "[?storageProfile.osDisk.osType=='Windows'].name" -o tsv); do
az vm run-command invoke -g rg-app -n $vm --command-id RunPowerShellScript \
--scripts "ipconfig /renew; ipconfig /flushdns; Get-DnsClientServerAddress -AddressFamily IPv4" --no-wait
done
# Linux VMs (systemd-networkd, e.g. Ubuntu); other distros use dhclient or NetworkManager
for vm in $(az vm list -g rg-app --query "[?storageProfile.osDisk.osType=='Linux'].name" -o tsv); do
az vm run-command invoke -g rg-app -n $vm --command-id RunShellScript \
--scripts "networkctl renew eth0 2>/dev/null || { dhclient -r eth0 && dhclient eth0; }; resolvectl flush-caches; resolvectl status | grep 'DNS Servers'" --no-wait
done
The interface name and DHCP client vary by distribution and image; check one VM by hand before running the loop.
If a renew doesn't pick up the change, restart that VM. Restart in batches by tier, not all at once. Application Gateway needs a stop and start to pick up new VNet DNS servers. Azure Firewall uses the DNS servers set in its own policy DNS settings, so check those separately if it does FQDN filtering or DNS proxy.
5. Verify recovery
Resolve-DnsName/digsucceeds for a public name, an internal AD name and aprivatelinkname from VMs in each affected subnet.- Domain logons work;
nltest /dsgetdc:<domain>returns a DC. - Application error rates return to baseline.
- DNS server VMs show normal query volume (Windows:
Get-DnsServerStatistics).
Communicate
"Name resolution failed for servers in
Prevent it next time
- Manage VNet DNS settings only through IaC, and alert on
Microsoft.Network/virtualNetworks/writein production hubs. - Run at least two DNS servers in different availability zones, and never patch or resize both in the same window.
- Use Azure DNS Private Resolver for conditional forwarding instead of a single forwarder VM.
- Allow UDP and TCP 53 to DNS servers explicitly in NSGs and firewall policy, and test it after every network change.
- Add a synthetic check (Connection Monitor or a scheduled script) that resolves a public, an internal and a
privatelinkname from each spoke every five minutes.
Get the weekly HubDatAI email
One email a week with everything new: posts, learning sessions and videos. Free, no spam, unsubscribe in one click. What you get