Hello @Jun Han ,
Welcome to Microsoft Q&A Platform. Thank you for reaching out & hope you are doing well.
I understand that you have one VNET01, which is already associated with on-prem DNS servers though the "custom DNS server" settings but now for a new project, you need to use private endpoints and hence private DNS zone for name solution within the VNET but the private DNS zone is not working when the custom DNS server setting is enabled. So you have a few questions that you need help with.
Answering your questions below:
Does custom DNS server setup work along with private DNS zone implementation?
Yes, custom DNS server setup works along with private DNS zone implementation.
Refer : https://learn.microsoft.com/en-us/azure/private-link/private-endpoint-dns#on-premises-workloads-using-a-dns-forwarder
If it does, what should I do to make it work?
As explained in the below docs, to configure your Vnet & On-premises workloads using a DNS forwarder properly, you need the following resources:
https://learn.microsoft.com/en-us/azure/private-link/private-endpoint-dns#on-premises-workloads-using-a-dns-forwarder
https://learn.microsoft.com/en-us/azure/private-link/private-endpoint-dns#virtual-network-and-on-premises-workloads-using-a-dns-forwarder
- On-premises network with a custom DNS solution in place
- Virtual network connected to on-premises
- DNS forwarder deployed in Azure
- Private DNS zones privatelink.database.windows.net with type A record
- Private endpoint information (FQDN record name and private IP address)
So, you would need to use a DNS forwarder to resolve the Azure service public DNS zone in Azure. A DNS forwarder is a Virtual Machine running on the Virtual Network linked to the Private DNS Zone that can proxy DNS queries coming from other Virtual Networks or from on-premises. This is required as the query must be originated from the Virtual Network to Azure DNS.
Conditional forwarder setup on the DNS forwarder in Azure:
Refer : https://github.com/adstuart/azure-privatelink-dns-microhack#task-3--add-conditional-forwarder-to-az-dns-vm-vm-in-azure
Conditional forwarder setup on your on-premise DNS server:
The conditional forwarding must be made to the recommended public DNS zone forwarder of the respective resource.
For example: database.windows.net instead of privatelink.database.windows.net.
Refer: https://github.com/adstuart/azure-privatelink-dns-microhack#task-3---setup-conditional-forwarder
For more clarity on the on-premise private DNS integration, please refer the below doc :
https://github.com/dmauser/PrivateLink/tree/master/DNS-Integration-Scenarios#4-on-premises-dns-integration
Or as an alternative to using a DNS forwarder in Azure, you can also use Azure DNS Private Resolver service.
Azure DNS Private Resolver is a new service that enables you to query Azure DNS private zones from an on-premises environment and vice versa without deploying VM based DNS servers.
Refer : https://learn.microsoft.com/en-us/azure/dns/dns-private-resolver-overview
https://learn.microsoft.com/en-us/azure/dns/private-resolver-hybrid-dns
Also, my understanding is that a virtual network can be linked to multiple private DNS zone if the auto registration is not enabled. Can you confirm it? In our case, we need to use private links for SQL DB, Blob Storage and Key Vault etc. Hence we need to use multiple private DNS zones as per Azure recommended private zone names.
Yes, your understanding is correct, A private DNS zone can have multiple registration virtual networks. However, every virtual network can only have one registration zone associated with it, meaning a specific virtual network can be linked to only one private DNS zone when automatic VM DNS registration is enabled.
Refer: https://learn.microsoft.com/en-us/azure/dns/private-dns-virtual-network-links
https://learn.microsoft.com/en-us/azure/dns/private-dns-autoregistration
Also, Auto registration works only for virtual machines. For all other resources like internal load balancers, you can create DNS records manually in the private DNS zone linked to the virtual network.
So, if you need need to use multiple private DNS zones for a single Vnet, you should not enable the autoregistration setting and create the DNS records manually for your resources.
A virtual network can get linked to a total of 1000 private DNS zones (without auto-registration enabled).
Refer: https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/azure-subscription-service-limits#azure-dns-limits
Kindly let us know if the above helps or you need further assistance on this issue.
----------------------------------------------------------------------------------------------------------------
Please "Accept the answer" if the information helped you. This will help us and others in the community as well.