Networking
Azure DNS Private Resolver: diagnose an overly specific forwarding rule before changing zones
A production runbook for proving which Azure DNS Private Resolver suffix rule wins, testing its targets, and canarying a bounded correction before changing private zones.
An internal API starts returning SERVFAIL from one Azure spoke just after a DNS forwarding rule is deployed. Other names under the parent domain still resolve, the network path to port 53 is open, and the private zone has not changed. The tempting responses are to add a record, relink the zone or open the NSG. None explains why only one branch of the namespace fails.
The running case uses Azure DNS Private Resolver with a ruleset linked to application VNets. The existing rule forwards corp.example. to the active on-premises resolvers. A newer rule forwards api.corp.example. to a resolver being retired. Both suffixes match orders.api.corp.example, but Azure selects the longest matching suffix. The narrower rule therefore diverts the query even though the parent rule remains healthy.
This runbook proves rule selection from the effective configuration and controlled queries, separates a bad target from a bad zone, canaries one bounded correction, and ends with an explicit promote or rollback decision. Private Endpoint records may exist elsewhere in the namespace, but they are not the diagnostic lens here.
Freeze one question and two source cohorts
Select one failing FQDN, one record type, one affected VNet and one healthy control VNet. Record the resolver actually used by each client, the complete response, TTL, latency and UTC window. Preserve the last known-good answer before flushing caches.
The comparison is useful only when the cohorts differ in one explainable way: ruleset link, DNS server configuration, region or deployment wave. A successful query from a laptop using corporate DNS is not a control for a workload using Azure-provided DNS and a linked ruleset.
Question
FQDN: orders.api.corp.example
Type: A
Expected answer: 10.60.12.24
Affected cohort
VNet and subnet: vnet-app-prod / snet-runtime
Client resolver: capture from the workload
Response: SERVFAIL, NXDOMAIN, timeout or unexpected IP
First failure in UTC
Control cohort
VNet and subnet: vnet-app-canary / snet-runtime
Client resolver: capture from the workload
Answer, TTL and response time
Change window
Rules added, disabled or retargeted
Ruleset links changed
Target DNS servers changed
Private zones or VNet DNS settings changed Reconstruct the effective suffix decision
Azure DNS Private Resolver evaluates enabled forwarding rules after linked private zones have had their chance to answer. If several rules match a name, the longest suffix wins. That makes a narrower rule a routing decision for a namespace, not a harmless exception beside the parent rule.
For orders.api.corp.example, write every matching suffix from most to least specific. Include only rules from rulesets linked to the source VNet. A rule visible in the subscription but not applicable to that VNet is inventory, not evidence.
Query: orders.api.corp.example.
Candidate suffixes from linked rulesets
api.corp.example. -> 10.30.4.53, 10.30.4.54 selected: longest match
corp.example. -> 10.20.4.53, 10.20.4.54
Checks before concluding
Rule is enabled
Ruleset is linked to the source VNet
No linked Private DNS zone answers the name first
Target IPs and port match the deployed rule
Client cache has not preserved an older answer If a linked private zone contains the queried namespace, prove its visibility and record state first. Do not claim a forwarding-rule incident when the query never reaches the ruleset.
Export rules and links as one immutable snapshot
Capture resource IDs, rule states, domain names, target DNS servers, outbound endpoints and VNet links. Compare the snapshot with the deployment source and the last known-good revision. Portal views split these objects and make an obsolete target easy to miss.
RG="rg-network-prod"
RESOLVER="pdnsr-hub-prod"
RULESET="pdnsrs-hybrid-prod"
az network dns-resolver show --resource-group "$RG" --name "$RESOLVER" --output jsonc
az network dns-resolver outbound-endpoint list --resource-group "$RG" --dns-resolver-name "$RESOLVER" --output jsonc
az network dns-resolver forwarding-ruleset rule list --resource-group "$RG" --ruleset-name "$RULESET" --output jsonc
az network dns-resolver forwarding-ruleset virtual-network-link list --resource-group "$RG" --ruleset-name "$RULESET" --output jsonc Retain the output with the incident. The minimum evidence is the full queried name, selected suffix, rule resource ID, target IPs, source VNet link and configuration revision that introduced the difference.
Test the selected targets independently
A port 53 probe shows reachability, not DNS correctness. Query each target named by the selected rule directly from an authorized diagnostic host on the relevant path. Use UDP and TCP, request the exact production name, and include a name that should not exist.
FQDN="orders.api.corp.example"
for DNS_IP in 10.30.4.53 10.30.4.54; do
echo "target=$DNS_IP protocol=udp"
dig @"$DNS_IP" "$FQDN" A +noall +answer +authority +comments +stats
echo "target=$DNS_IP protocol=tcp"
dig +tcp @"$DNS_IP" "$FQDN" A +noall +answer +authority +comments +stats
echo "target=$DNS_IP negative-control"
dig @"$DNS_IP" does-not-exist.api.corp.example A +noall +authority +comments +stats
done Interpret the results by layer:
- Both targets return the same fast negative response: verify whether the narrower namespace is authoritative there and whether the expected record exists.
- One target succeeds and the other times out or returns stale data: repair or remove only the unhealthy target after checking why it remained in the rule.
- Both targets answer correctly when queried directly, but the client fails: inspect source-VNet applicability, the outbound path, cache and any intermediate DNS service.
- The parent-rule targets answer correctly while the narrower-rule targets fail: the selection and target evidence together explain the incident.
- UDP and TCP differ: qualify NSG, UDR, firewall, NVA and response-size behavior before editing DNS content.
Prove that the rule, not the application, owns the symptom
Replay the same name from the affected and control VNets after recording client DNS configuration. Then query one name that matches only the parent suffix and another that matches the narrower suffix. This small matrix avoids turning a single dig into a broad conclusion.
Affected VNet
app.corp.example expected parent-rule answer
orders.api.corp.example current failure through narrower rule
missing.api.corp.example expected negative response
Control VNet
Same three questions
Record resolver, answer, TTL, latency and UTC timestamp
Decision evidence
Parent-only name succeeds from affected VNet
Narrower suffix fails only where the ruleset link applies
Direct target query reproduces the selected-rule behavior
Application error window aligns with DNS response changes If the application still fails while the exact DNS questions return the expected answers, stop changing DNS. Continue at TCP, TLS, identity or application state with the DNS evidence preserved.
Canary one bounded correction
Choose the correction that matches the proven fault:
- Retarget the narrower rule when that namespace legitimately has a separate authority but its servers are wrong.
- Disable the narrower rule when the parent authority should answer the entire branch.
- Remove one unhealthy target when the remaining target is authoritative and capacity is proven.
- Correct the VNet link when the rule is valid but was exposed to the wrong consumer network.
Do not delete the parent rule, relink every private zone or replace VNet DNS servers as a first response. Export the current rule as the rollback artifact, make the change through the normal deployment path, and expose it first to a canary VNet or bounded resolver cohort.
Validate across TTL and application behavior
The canary passes only when the original question, a parent-only name, a negative control and the business transaction all behave as designed. Repeat tests across at least one relevant TTL boundary so an old positive answer does not impersonate recovery.
DNS gate
Selected suffix and target match the intended authority
Original FQDN returns the expected answer repeatedly
Parent-only name does not regress
Negative control remains negative
UDP and TCP behavior is understood
Affected and control cohorts converge after cache expiry
Application gate
Original transaction succeeds from the affected subnet
Error rate and DNS latency return to baseline
No fallback to an unintended public or legacy address appears
Rollback readiness
Previous rule state, targets and links are captured
IaC revision for restoration is identified
Owner and maximum canary window are named Decide, promote or roll back
Promote the correction only when the longest-suffix decision explains the observed split, direct target tests reproduce it, and the canary passes the DNS and application gates. Update the deployment source and add a pre-deployment check that prints overlapping suffixes, affected VNet links and target ownership for review.
Roll back if an unrelated child namespace regresses, the selected targets still disagree, the application remains unhealthy, or the source cohorts do not converge. Restore the captured rule state and continue at the next unproven boundary. A failed canary is evidence that the narrower rule was not the whole cause; it is not a reason to rewrite private zones broadly.
Conclusion
Overlapping forwarding rules are deterministic, but their effect is easy to misread when teams inspect only the parent suffix. Freeze one DNS question, prove which linked rule wins, test its targets independently, and canary the smallest correction. The production decision then becomes defensible: retain the specific rule with healthy authority, remove it in favor of the parent, or restore the previous state and investigate the next layer.