Private DNS vs Custom DNS for one VNET

Jun Han 31 Reputation points
2023-01-04T01:35:57.1+00:00

Context

I have one VNET01, which is already associated with a number of on-prem DNS servers though the "custom DNS server" settings. These on-prem DNS servers have some DNS forwarders, which point to ISP DNS servers.

Task

For a new project, I need to use private endpoints and hence private DNS zone for name solution within the VNET. I hence created a private DNS zone and linked it with VNET01.

Issue
The name resolution always used custom DNS servers, not used private DNS zone. The DNS request was from within VNET01.

Observation

If I disabled the custom DNS servers, the private DNS zone works.

Questions

  • Does custom DNS server setup work along with private DNS zone implementation?
  • If it does, what should I do to make it work?
  • 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.

Regards,

Jun

Azure DNS
Azure DNS
An Azure service that enables hosting Domain Name System (DNS) domains in Azure.
777 questions
0 comments No comments
{count} vote

Accepted answer
  1. TP 125.8K Reputation points Volunteer Moderator
    2023-01-04T03:13:00.727+00:00

    Hi Jun,

    The behavior you are seeing in regards to having custom DNS server specified for the VNet is expected. When you set custom DNS servers you are specifying the list of DNS servers to be given to VMs via DHCP, which means they will not be querying the Azure private DNS.

    For your scenario I would recommend Azure Private DNS Resolver. How you configure it is up to your specific needs. For example, you could keep current configuration whereby you set custom DNS and have queries sent to your on-premises servers. After you have Private DNS Resolver set up, you would configure you on-premises DNS servers to conditionally forward requests for private endpoints to the Private DNS Resolver's inbound endpoint. In this way VMs in the VNet as well as VMs/machines in your on-premises network would be able to resolve your private endpoints.

    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.

    A: Yes, you can have multiple Private DNS zones linked to your VNet. These would be resolution zones.

    Please see article below for more information on Azure DNS Private Resolver:

    What is Azure DNS Private Resolver?

    https://learn.microsoft.com/en-us/azure/dns/dns-private-resolver-overview

    Thanks.

    -TP


1 additional answer

Sort by: Most helpful
  1. GitaraniSharma-MSFT 50,096 Reputation points Microsoft Employee Moderator
    2023-01-04T03:31:30.647+00:00

    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.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.