Today, I worked on a service request that is very odd. Our customer is using PHP with a very old driver and trying to connect to the public endpoint of Manage Instance they got several errors like: [Microsoft][SQL Native Client][SQL Server]Server name cannot be determined. It must appear as the first segment of the server's dns name (servername.database.windows.net). Some libraries do not send the server name, in which case the server name must be included as part of the user name (username@servername). In addition, if both formats are used, the server names must match.
The first point that I found is that the public endpoint of a Azure SQL Managed Instance is using 5 parts to identify the FQDN, InstanceName.Public.VirtualCluster.database.windows.net, for the error message all points to that in this driver version is validating the server name.
So, for any specific reason, our customer needs to use the public endpoint instead of the normal FQDN: InstanceName.VirtualCluster.database.windows.net.
So, we know that the connection needs to be validated with our certificates and domain database.windows.net, my suggestion, meanwhile our customer tries to update the driver was:
- Run a ping command against the public endpoint InstanceName.Public.VirtualCluster.database.windows.net to have the IP, for example, 22.214.171.124
- Add an entry in the c:\windows\system32\drivers\etc\host file the following line:
- 126.96.36.199 InstanceName.database.windows.net
- After it, try to connect to InstanceName.database.windows.net with port 3342 and they were able to connect.
- This was a workaround to connect at this time meanwhile our customer tried to find the best moment to update the driver.
- After the driver was updated, the entry of the host name was removed and our customer was able to connect using the normal FQDN: InstanceName.Public.VirtualCluster.database.windows.net with por 3342.