Today, I worked on a service request with the the following scenario:
SQL Server running on a Virtual Machine on Azure without public IP, just only, is accesible from the Virtual Network.
Azure SQL Managed Instance needs to connect using Linked Server to this SQL Server. It is possible to connect using the IP but not the name.
And I found during my troubleshooting process:
I created a virtual machine in the virtual network where is running Azure SQL Managed Instance and I didn’t specify public IP.
Running Ipconfig /All I saw that the DNS suffix is: When you are using Azure-provided name resolution, Azure Dynamic Host Configuration Protocol (DHCP) provides an internal DNS suffix (.internal.cloudapp.net) to each VM. This suffix enables host name resolution because the host name records are in the internal.cloudapp.net zone
For this reason, trying to connect for any machine of this virtual network was totally possible just only defining the name because the DNS is internal.cloudapp.net.
However, the DNS registration of Azure SQL Managed Instance is different. You could see the information here.
In this situation, using a virtual machine of this virtual network, I installed and configured a DNS , I added the internal IP of this DNS and also the IP:126.96.36.199 of Azure DNS, as you could see in this URL.
After restarting all the virtual machines and scale up and down the Azure SQL Managed Instance, I was able to connect using the name of the server and the domain of DNS. In fact, sometimes we need to create an internal ticket to our Azure Product Team to restart the physical machine to register the new DNS. Or perhaps, it is a good idea have the DNS configured before creating a new Azure SQL Managed Instance.