Home
%3CLINGO-SUB%20id%3D%22lingo-sub-750708%22%20slang%3D%22en-US%22%3ELesson%20Learned%20%23101%3A%20PHP%20and%20public%20endpoint%20of%20Azure%20SQL%20Managed%20Instance.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-750708%22%20slang%3D%22en-US%22%3E%3CP%3EToday%2C%20I%20worked%20on%20a%20service%20request%20that%20is%20very%20odd.%26nbsp%3BOur%20customer%20is%20using%20PHP%20with%20a%20very%20old%20driver%20and%20trying%20to%20connect%20to%20the%20public%20endpoint%20of%20Manage%20Instance%20they%20got%20several%20errors%20like%3A%26nbsp%3B%5BMicrosoft%5D%5BSQL%20Native%20Client%5D%5BSQL%20Server%5DServer%20name%20cannot%20be%20determined.%20It%20must%20appear%20as%20the%20first%20segment%20of%20the%20server's%20dns%20name%20(servername.database.windows.net).%20Some%20libraries%20do%20not%20send%20the%20server%20name%2C%20in%20which%20case%20the%20server%20name%20must%20be%20included%20as%20part%20of%20the%20user%20name%20(username%40servername).%20In%20addition%2C%20if%20both%20formats%20are%20used%2C%20the%20server%20names%20must%20match.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20first%20point%20that%20I%20found%20is%20that%20the%20public%20endpoint%20of%20a%20Azure%20SQL%20Managed%20Instance%20is%20using%205%20parts%20to%20identify%20the%20FQDN%2C%20InstanceName.Public.VirtualCluster.database.windows.net%2C%20for%20the%20error%20message%20all%20points%20to%20that%20in%20this%20driver%20version%20is%20validating%20the%20server%20name.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESo%2C%20for%20any%20specific%20reason%2C%20our%20customer%20needs%20to%20use%20the%20public%20endpoint%20instead%20of%20the%20normal%20FQDN%3A%26nbsp%3BInstanceName.VirtualCluster.database.windows.net.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESo%2C%20we%20know%20that%20the%20connection%20needs%20to%20be%20validated%20with%20our%20certificates%20and%20domain%20database.windows.net%2C%20my%20suggestion%2C%20meanwhile%20our%20customer%20tries%20to%20update%20the%20driver%20was%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3ERun%20a%20ping%20command%20against%20the%20public%20endpoint%20InstanceName.Public.VirtualCluster.database.windows.net%20to%20have%20the%20IP%2C%20for%20example%2C%2011.11.11.11%3C%2FLI%3E%0A%3CLI%3EAdd%20an%20entry%20in%20the%20c%3A%5Cwindows%5Csystem32%5Cdrivers%5Cetc%5Chost%20file%20the%20following%20line%3A%3CUL%3E%0A%3CLI%3E11.11.11.11%20InstanceName.database.windows.net%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3CLI%3EAfter%20it%2C%20try%20to%20connect%20to%20InstanceName.database.windows.net%20with%20port%203342%20and%20they%20were%20able%20to%20connect.%26nbsp%3B%3C%2FLI%3E%0A%3CLI%3EThis%20was%20a%20workaround%20to%20connect%20at%20this%20time%20meanwhile%20our%20customer%20tried%20to%20find%20the%20best%20moment%20to%20update%20the%20driver.%3C%2FLI%3E%0A%3CLI%3EAfter%20the%20driver%20was%20updated%2C%20the%20entry%20of%20the%20host%20name%20was%20removed%20and%20our%20customer%20was%20able%20to%20connect%20using%20the%20normal%20FQDN%3A%26nbsp%3BInstanceName.Public.VirtualCluster.database.windows.net%20with%20por%203342.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EEnjoy!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-750708%22%20slang%3D%22en-US%22%3E%3CP%3EToday%2C%20I%20worked%20on%20a%20service%20request%20that%20is%20very%20odd.%26nbsp%3BOur%20customer%20is%20using%20PHP%20with%20a%20very%20old%20driver%20and%20trying%20to%20connect%20to%20the%20public%20endpoint%20of%20Manage%20Instance%20they%20got%20several%20errors%20like%3A%26nbsp%3B%5BMicrosoft%5D%5BSQL%20Native%20Client%5D%5BSQL%20Server%5DServer%20name%20cannot%20be%20determined.%20It%20must%20appear%20as%20the%20first%20segment%20of%20the%20server's%20dns%20name%20(servername.database.windows.net).%20Some%20libraries%20do%20not%20send%20the%20server%20name%2C%20in%20which%20case%20the%20server%20name%20must%20be%20included%20as%20part%20of%20the%20user%20name%20(username%40servername).%20In%20addition%2C%20if%20both%20formats%20are%20used%2C%20the%20server%20names%20must%20match.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-TEASER%3E

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, 11.11.11.11
  • Add an entry in the c:\windows\system32\drivers\etc\host file the following line:
    • 11.11.11.11 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.

 

Enjoy!