A scalable, fully managed NoSQL database for JSON documents with fast queries and automatic indexing
Azure Cosmos DB for MongoDB vCore (DocumentDB) doesn’t expose a direct IP address that must be registered in Azure DNS for connectivity. Connectivity is based on DNS names and SRV records, and clients must use the mongodb+srv connection string provided in the Azure portal.
To verify and troubleshoot DNS/connection issues for the vCore cluster:
- Verify the private endpoint (if used)
- In the Azure portal, open the DocumentDB (MongoDB vCore) cluster.
- Go to Networking and confirm the private endpoint is listed with status Approved.
- Select the private endpoint and note the assigned private IP.
- Validate DNS resolution from within the virtual network
- From a Windows VM in the same VNet/peered VNet:
- Resolve the SRV record:
Resolve-DnsName -Name _mongodb._tcp.<your-cluster-name>.mongocluster.cosmos.azure.com -Type SRV - Resolve each node hostname returned by the SRV record and confirm they resolve to private IPs (10.x.x.x, etc.):
Resolve-DnsName -Name <your-node-hostname>.mongocluster.cosmos.azure.com
- Resolve the SRV record:
- From Linux/macOS in the same VNet/peered VNet:
- Resolve the SRV record:
dig _mongodb._tcp.<your-cluster-name>.mongocluster.cosmos.azure.com SRV - Resolve each node hostname:
dig <your-node-hostname>.mongocluster.cosmos.azure.com
- Resolve the SRV record:
- From a Windows VM in the same VNet/peered VNet:
- Fix common DNS issues
- If DNS returns public IPs or fails:
- Ensure the private DNS zone
privatelink.mongocluster.cosmos.azure.comexists and is linked to the VNet. - Verify the DNS zone group is correctly configured on the private endpoint.
- Confirm the VNet DNS servers are either Azure-provided DNS (168.63.129.16) or a custom DNS that forwards to Azure DNS.
- Make sure tests are run from within the VNet or a properly peered VNet.
- Ensure the private DNS zone
- If DNS returns public IPs or fails:
- Fix connection timeouts
- Check NSG rules on the subnet to allow outbound traffic on port 27017.
- Confirm the private endpoint NIC shows the expected private IP.
- Ensure the client uses the exact
mongodb+srv://connection string from the portal (no modifications). - Verify cluster firewall rules allow access from the private endpoint or required IP ranges.
- If DNS still doesn’t resolve correctly
- For custom DNS solutions, run
nslookup <fqdn>for each FQDN listed in the private endpoint’s DNS configuration and confirm the returned IP matches the private IP shown in the portal. If not, update the custom DNS configuration so those names resolve to the private IP.
- For custom DNS solutions, run
If these checks succeed, the cluster is correctly registered and reachable via Azure DNS, and clients should connect using the provided mongodb+srv connection string rather than a raw IP address.
References: