This article is contributed. See the original author and article here.

If you’re using Azure Database for MySQL and have encountered issues with name resolution or the Domain Name System (DNS) when attempting to connect to your server from different sources and networks, then this blog post is for you! In the next sections, I’ll explain the causes of these types of issues and what you need to do to resolve them. 


What are DNS issues? 

DNS is a service that translates domain names (e.g., into IP addresses (e.g., to make it easier for us to identify remember and access websites and servers. 


However, at time the DNS service can fail to resolve the domain name to the IP address, or it might resolve it to the wrong IP address. This can result in errors such as “Host not Known” or “Unknown host” when you specify the server name for making connections. 


Diagnosing DNS issues 

To diagnose DNS issues, use tools such as Ping or nslookup to verify that the host name is being resolved from the source. To test using ping, for example, on the source, run the following command: 




If the server’s name is not resolving, a response similar to the following should appear: 


Fig 1: Ping request not returning IP 


To test using nslookup, on the source, run the following command: 




Again, if the server name is not resolving, a response similar to the following should appear: 


Fig 2: nslookup to DNS request not returning IP 


If on the other hand the commands return the correct IP address of the server, then the DNS resolution is working properly. If the commands return an error or a different IP address, then there is a DNS issue. 


To verify the correct IP address of the server, you can check the Private DNS zone of the Azure Database for MySQL Flexible server. The Private DNS zone is a service that provides name resolution for private endpoints within a virtual network (vNet). You can find the Private DNS zone in the properties of the overview blade of the server, as shown in the following figure: 




Fig 3: Checking the private DNS zone in the Properties of overview blade 


In the Private DNS zone, you can see the currently assigned IP address to the MySQL Flexible server, as shown in the following figure: 




Fig 4: Private DNS Zone overview 


Resolving DNS issues 

The solution to fix DNS issues depends on the source and the network configuration of the server. In this blog, I will cover two common scenarios: when the source is using the default (Azure-provided) DNS, and when the source is using a custom DNS. 


Scenario 1: Source is using the default (Azure-provided) DNS 

The default (Azure-provided) DNS can only be used by sources in Azure that have private endpoint, vNet integration, or have IPs defined from a vNet. If you are using the default DNS and you are getting a DNS issue, you need to check the following: 


  • vNet of the source: Check the vNet of the source (also check NIC level configuration in case of Azure VM) and make sure that it is set to Azure-provided DNS. You can check this on the vNet > DNS servers blade, as shown in the following figure: 



Fig 5: DNS servers blade in virtual network 


  • Private DNS zone of the server: Go to the Private DNS zone of the MySQL Flexible server and add the vNet of the source to the Virtual Network Link blade, as shown in the following figure: 



Fig 6: Adding virtual network link to private DNS zone 


After these steps, you should be able to ping and nslookup the server’s name from the source and get the correct IP address. 


Scenario 2: Source is using a custom DNS 

This is the most commonly used scenario by the users. This pattern can be used in a hub-and-spoke model and also for name resolution from on-premises servers. In this scenario, a custom DNS server is deployed in a hub vNet that is linked to the on-premises DNS server. It can also be deployed without having on-prem connectivity, as shown in the following figure: 



Fig 7: Network diagram showing access through custom DNS server in Hub and Spoke network. 


In this scenario, the MySQL Flexible server is deployed in a delegated subnet in Spoke2. Spoke1, Spoke2, and Spoke3 are connected through the Hub vNet. Spoke1 and Spoke3 have a custom DNS server configured which is deployed in the Hub vNet. Since both spoke vNets (1 and 3) are connected through the Hub vNet, clients can directly connect with the MySQL Flexible server with IP address only and DNS name resolution would not work. 


To fix this issue, perform the following steps:

  • Conditional forwarder: Add a conditional forwarder on the custom DNS for domain. This conditional forwarder must point to the Azure DNS IP address:, as shown in the following figure: 



Fig 8: Adding conditional forwarder for 


  • Virtual network link: You need to add a virtual network link in the Private DNS zone for the custom DNS server’s vNet, as described in the previous scenario. 

  • On-premises DNS: If you have clients on-premises that need to connect to the Flexible server FQDN, then you need to add a conditional forwarder in the on-premises DNS server pointing to the IP address of the custom DNS server in Azure for Alternatively, you can use the same custom DNS IP in additional DNS servers on on-premises clients. 



In this blog, I have shown you how to solve DNS issues with Azure Database for MySQL using different DNS scenarios. I hope this helps you to enjoy the benefits of using Azure Database for MySQL for your applications. 


We are always interested in how you plan to use Flexible Server deployment options to drive innovation to your business and applications. Additional information on topics discussed above can be found in the following documents: 



If you have any questions about the detail provided above, please leave a comment below or email us at Thank you!


Brought to you by Dr. Ware, Microsoft Office 365 Silver Partner, Charleston SC.