Azure Private Endpoints allow applications to access Azure services through private IP addresses inside a virtual network. They help organizations reduce exposure to public networks and build more secure architectures for services such as Azure Storage, Azure SQL Database, Azure Key Vault, and Azure Cosmos DB.
However, creating a private endpoint does not automatically guarantee that applications will connect to it through the correct private IP address. DNS configuration plays an important role in this process.
An application might still resolve a service hostname to its public IP address, even when a private endpoint exists and its connection status is Approved. In other situations, DNS queries might return NXDOMAIN, SERVFAIL, or time out completely.
This article explains how Azure Private DNS works with private endpoints, how to test DNS resolution, how to identify common configuration problems, and how to troubleshoot private DNS resolution in production environments.
Understanding Azure Private DNS and Private Endpoints
A private endpoint provides a network interface with a private IP address in an Azure virtual network. This interface connects privately to an Azure service through Azure Private Link.
For example, suppose an application accesses an Azure Storage account using the following hostname:
mystorageaccount.blob.core.windows.net
When the application uses a private endpoint, DNS must resolve the service hostname to the private IP address assigned to that endpoint.
A common DNS configuration uses a private DNS zone such as:
privatelink.blob.core.windows.net
The public service hostname can resolve through a CNAME to the corresponding private-link hostname. The private DNS zone then provides an A record that maps the private-link hostname to the private endpoint IP address.
The expected resolution flow looks like this:
Application
|
| mystorageaccount.blob.core.windows.net
|
v
Azure DNS Resolution
|
v
Private DNS Zone
|
| privatelink.blob.core.windows.net
|
v
Private A Record
|
v
10.10.1.5
|
v
Azure Storage Private Endpoint
The private IP address in this example is illustrative. In a real environment, the address depends on the subnet and private endpoint configuration.
The important requirement is that the application resolves the service hostname to the private endpoint IP address from the network where the application runs.
Understanding the DNS Requirements
A working private endpoint DNS configuration generally requires three components.
Private DNS zone
The private DNS zone contains the DNS records required to resolve private endpoint hostnames.
Some commonly used Azure Private DNS zones include:
Azure Blob Storage:
privatelink.blob.core.windows.net
Azure SQL Database:
privatelink.database.windows.net
Azure Key Vault:
privatelink.vaultcore.azure.net
Azure Files:
privatelink.file.core.windows.net
Azure Container Registry:
privatelink.azurecr.io
Azure Cosmos DB:
privatelink.documents.azure.com
The required zone depends on the Azure service and the endpoint subresource being used. Always verify the recommended DNS zone for the specific service.
Virtual network link
A private DNS zone must be linked to the virtual network from which clients need to resolve private endpoint names.
For example, suppose a private endpoint is deployed in a production virtual network, while an application runs in a separate application virtual network.
The private DNS zone must be available to the application network through an appropriate DNS configuration. Simply creating the zone in the same subscription does not make it automatically available to every virtual network.
DNS zone group
A private DNS zone group connects a private endpoint to one or more private DNS zones.
When configured correctly, Azure can manage the DNS records associated with the private endpoint. This reduces the need to manually create and maintain A records when endpoint information changes.
Testing Private Endpoint DNS Resolution
The first troubleshooting step is to check which IP address the service hostname resolves to.
Run the DNS test from the actual client environment. This could be an Azure virtual machine, an application server, a container, or an on-premises machine connected to Azure.
Testing from an unrelated machine can produce different results because DNS configuration depends on the network and resolver used by the client.
Using nslookup
On Windows, Linux, or macOS, run:
nslookup mystorageaccount.blob.core.windows.net
A successful private DNS resolution should ultimately return the private endpoint IP address.
For example:
Server: 168.63.129.16
Address: 168.63.129.16
Non-authoritative answer:
Name: mystorageaccount.privatelink.blob.core.windows.net
Address: 10.10.1.5
Aliases: mystorageaccount.blob.core.windows.net
The output format can vary depending on the operating system and DNS resolver. The important result is the final private IP address.
If the response contains a public IP address, the client is not resolving the hostname through the expected private DNS configuration.
Using dig on Linux
The dig command provides additional information about DNS queries and is useful when investigating CNAME records.
Run:
dig mystorageaccount.blob.core.windows.net
To inspect the CNAME chain, run:
dig mystorageaccount.blob.core.windows.net CNAME
To query the private-link hostname directly, run:
dig mystorageaccount.privatelink.blob.core.windows.net A
You can also request a concise answer:
dig +short mystorageaccount.blob.core.windows.net
If the final answer is the private endpoint IP address, DNS resolution is working as expected for that client.
Using PowerShell
Windows administrators can use Resolve-DnsName:
Resolve-DnsName mystorageaccount.blob.core.windows.net
To query a particular DNS server, specify its address:
Resolve-DnsName mystorageaccount.blob.core.windows.net `
-Server 168.63.129.16
This helps compare the response from Azure-provided DNS with the response from the DNS server configured on the client.
Remember that 168.63.129.16 is an Azure platform virtual IP address. It is not a general-purpose DNS server that can be queried directly from an on-premises network.
Verifying the Private DNS Zone Configuration
If DNS returns a public IP address or NXDOMAIN, inspect the private DNS zone and its records.
First, list the private DNS zones in the resource group:
az network private-dns zone list \
--resource-group rg-private-dns \
--output table
For Azure Storage, verify that the required zone exists:
privatelink.blob.core.windows.net
Next, inspect the A records:
az network private-dns record-set a list \
--resource-group rg-private-dns \
--zone-name privatelink.blob.core.windows.net \
--output table
Confirm that the storage account record exists and points to the private IP address assigned to the private endpoint.
For example:
Name TTL ARecords
------------------- ----- -------------
mystorageaccount 3600 10.10.1.5
If the record is missing or contains an outdated address, investigate the private endpoint DNS zone group and the record management configuration.
Checking Virtual Network Links
A private DNS zone can contain the correct A record and still fail to resolve from a particular virtual network.
This commonly happens when the virtual network from which the DNS query originates is not linked to the private DNS zone.
List the virtual network links:
az network private-dns link vnet list \
--resource-group rg-private-dns \
--zone-name privatelink.blob.core.windows.net \
--output table
Check whether the application virtual network appears in the results.
If the required link is missing, create it:
az network private-dns link vnet create \
--resource-group rg-private-dns \
--zone-name privatelink.blob.core.windows.net \
--name link-to-application-vnet \
--virtual-network "/subscriptions/<subscription-id>/resourceGroups/rg-network/providers/Microsoft.Network/virtualNetworks/vnet-application" \
--registration-enabled false
For private endpoint DNS zones, automatic registration should normally be disabled. Automatic registration is designed for registering virtual machine records, not for maintaining private endpoint records.
After creating the link, test DNS resolution again from the application virtual network.
Checking the Private Endpoint DNS Zone Group
A private endpoint can be approved and connected while its DNS configuration remains incomplete.
To inspect the DNS zone groups associated with a private endpoint, run:
az network private-endpoint dns-zone-group list \
--resource-group rg-private-endpoints \
--endpoint-name pe-storage
Check whether the expected private DNS zone is associated with the endpoint.
You should also inspect the private endpoint network interface to verify its assigned IP address and DNS configuration.
For example:
az network private-endpoint show \
--resource-group rg-private-endpoints \
--name pe-storage \
--query "networkInterfaces[].id" \
--output tsv
If the DNS zone group is missing, review the private endpoint configuration and create the appropriate zone group using the supported Azure CLI or portal workflow.
Avoid manually creating duplicate DNS records without first understanding how the existing zone group manages them.
Troubleshooting Custom DNS Servers
Many production environments use custom DNS servers instead of Azure-provided DNS.
These servers might run on virtual machines, use Active Directory Domain Services, or forward queries through Azure Firewall DNS Proxy.
In these environments, linking a private DNS zone to a virtual network might not be sufficient. The custom DNS server must also be configured to resolve private endpoint names correctly.
For example, consider the following architecture:
Application VM
|
v
Custom DNS Server
|
v
Conditional Forwarder
|
v
Azure DNS Private Resolver
|
v
Azure Private DNS Zone
|
v
Private Endpoint IP
A common design uses Azure DNS Private Resolver to support hybrid DNS resolution between on-premises networks and Azure virtual networks.
The on-premises DNS server forwards the appropriate queries to the inbound endpoint of Azure DNS Private Resolver. The resolver can then use Azure DNS to resolve names from linked private DNS zones.
Do not configure an on-premises DNS server to query 168.63.129.16 directly. That address is accessible from within Azure virtual networks and is not reachable as a general DNS forwarding target from on-premises networks.
Testing a custom DNS server
Use nslookup to query the custom DNS server directly:
nslookup mystorageaccount.blob.core.windows.net 10.10.0.4
Here, 10.10.0.4 represents the example custom DNS server address.
Compare the result with a query made through the DNS resolver configured for the Azure virtual network.
If Azure DNS returns the private endpoint IP but the custom DNS server returns a public IP or NXDOMAIN, investigate conditional forwarding, forwarding rules, and resolver connectivity.
Diagnosing Common DNS Errors
Different DNS responses provide useful clues about the underlying configuration problem.
DNS returns a public IP address
This usually means the client is resolving the service through public DNS instead of the expected private DNS configuration.
Possible causes include:
The private DNS zone is not linked to the client virtual network.
The A record is missing or contains an incorrect address.
The custom DNS server is not forwarding the query correctly.
The client is using a different DNS resolver than expected.
Start by checking the private DNS zone, its virtual network links, and the DNS server used by the client.
DNS returns NXDOMAIN
NXDOMAIN means that the resolver could not find the requested DNS record.
Possible causes include a missing A record, an incorrect hostname, or a private DNS zone that overrides a namespace but does not contain the requested record.
This last situation can affect applications accessing multiple resources within the same DNS namespace. A private zone may answer for the namespace but return NXDOMAIN for resources that do not have records in that zone.
Review the private DNS records and determine whether the zone requires an appropriate fallback strategy, such as NxDomainRedirect where supported.
DNS returns SERVFAIL
SERVFAIL indicates that the DNS resolver could not complete the query successfully.
Investigate custom DNS forwarding, resolver availability, and network communication between DNS components.
If the issue occurs only for large DNS responses, also investigate UDP fragmentation, TCP fallback, and network appliances between the client and resolver.
DNS queries time out
A timeout usually indicates that the DNS client is not receiving a response from its configured resolver.
Check whether UDP and TCP port 53 traffic is permitted between the client and DNS server. Review network security groups, firewall rules, routing, and the availability of the resolver.
A DNS timeout is different from NXDOMAIN. One indicates a failure to receive a usable response, while the other is a DNS response indicating that the requested name does not exist.
Testing Network Connectivity After DNS Resolution
Successful DNS resolution does not guarantee that the application can connect to the private endpoint.
Once the hostname resolves to the expected private IP address, test the network connection separately.
For a service that uses HTTPS, run:
curl -v https://mystorageaccount.blob.core.windows.net
For a basic TCP connectivity test from PowerShell:
Test-NetConnection mystorageaccount.blob.core.windows.net `
-Port 443
You can also test the private endpoint IP directly:
Test-NetConnection 10.10.1.5 -Port 443
The port depends on the Azure service and its protocol.
If DNS resolves correctly but the connection fails, investigate the private endpoint connection state, subnet network policies, network security groups, user-defined routes, virtual network peering, and service-level access controls.
For example, an approved private endpoint does not automatically guarantee that every client subnet has a valid route or permitted connection to its private IP address.
Keep DNS troubleshooting and network connectivity troubleshooting as separate diagnostic steps.
Automating Private DNS Validation
For production environments, manually checking every private endpoint is not practical. A small validation script can help identify DNS resolution problems before they affect applications.
The following Bash example checks whether a hostname resolves to an expected private IP address:
#!/bin/bash
HOSTNAME="mystorageaccount.blob.core.windows.net"
EXPECTED_IP="10.10.1.5"
RESOLVED_IP=$(dig +short "$HOSTNAME" | tail -n 1)
if [ "$RESOLVED_IP" = "$EXPECTED_IP" ]; then
echo "PASS: Private DNS resolution is correct."
else
echo "FAIL: DNS resolution does not match the expected IP."
echo "Expected: $EXPECTED_IP"
echo "Received: $RESOLVED_IP"
fi
This example assumes the final DNS answer is an IPv4 address and that the expected private IP is known. For production use, extend the script to handle multiple returned addresses, CNAME chains, IPv6 responses, DNS timeouts, and changes to private endpoint IP assignments.
A more complete monitoring solution can periodically validate important private endpoint hostnames from representative application networks and alert the platform team when the result changes unexpectedly.
Best Practices for Production Environments
Use a consistent private DNS naming strategy across subscriptions, resource groups, and virtual networks. Centralized DNS management can make large Azure environments easier to maintain.
Use private DNS zone groups wherever supported to maintain endpoint records automatically. Avoid relying on manually maintained A records unless there is a clear operational reason.
Link private DNS zones to the virtual networks that need to resolve the corresponding private endpoints. In hub-and-spoke environments, plan DNS resolution centrally and verify that spoke networks use the intended resolver.
If custom DNS servers are used, document conditional forwarders and test them from the actual client networks. For hybrid environments, consider Azure DNS Private Resolver instead of forwarding directly to Azure's internal DNS address from on-premises systems.
Run DNS tests from the same environment where the application executes. A successful query from an administrator's workstation does not prove that an application running in a different virtual network or container can resolve the same hostname.
Finally, monitor DNS resolution and network connectivity independently. This makes it easier to identify whether a failure is caused by a missing DNS record, an incorrect resolver, a network restriction, or an application-level issue.
Conclusion
Azure Private DNS is an essential part of a reliable Azure Private Endpoint implementation. Even when a private endpoint is successfully created and approved, applications can still connect through public endpoints if DNS is not configured correctly.
Testing with nslookup, dig, and Resolve-DnsName helps verify which IP address a service hostname resolves to. Azure CLI commands can then be used to inspect private DNS zones, A records, virtual network links, and private endpoint DNS zone groups.
For production environments, DNS validation should be performed from the actual application network, and custom DNS forwarding should be tested separately. Combining DNS checks with network connectivity tests helps platform teams identify problems faster and maintain reliable private connectivity to Azure services.
Join the conversation! Your thoughts help the community grow.