%3CLINGO-SUB%20id%3D%22lingo-sub-2121370%22%20slang%3D%22en-US%22%3ELesson%20Learned%20%23161%3A%20Error%200%20-%20No%20such%20host%20is%20known%20in%20Azure%20SQL%20Managed%20Instance%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2121370%22%20slang%3D%22en-US%22%3E%3CP%3EToday%2C%20I%20worked%20on%20an%20interesting%20service%20request%20where%20our%20customer%20is%20facing%20the%20error%20message%20%22%3CSPAN%3E%3CSTRONG%3EConnection%20to%20database%20master%20failed%20(error%2011001%2C%20state%200)%3A%20A%20network-related%20or%20instance-specific%20error%20occurred%20while%20establishing%20a%20connection%20to%20SQL%20Server.%20The%20server%20was%20not%20found%20or%20was%20not%20accessible.%20Verify%20that%20the%20instance%20name%20is%20correct%20and%20that%20SQL%20Server%20is%20configured%20to%20allow%20remote%20connections.%20(provider%3A%20TCP%20Provider%2C%20error%3A%200%20-%20No%20such%20host%20is%20known.)%3C%2FSTRONG%3E%22%26nbsp%3B%3C%2FSPAN%3Etrying%20to%20connect%20to%20Azure%20SQL%20Managed%20Instance.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAll%20points%20to%20that%20the%20issue%20is%20related%20about%20DNS%20resolution%20based%20on%20the%20message%20%22No%20such%20host%20is%20known%22.%20In%20this%20situation%2C%20we%20saw%20that%20our%20customer%20created%20their%20own%20entry%20in%20their%20custom%20DNS%20to%20the%20.database.windows.net%20DNS%20Zone%20pointing%20to%20the%20name%20of%20the%20Azure%20SQL%20Managed%20Instance%2C%20for%20example%2C%20nameofmanagedinstance.virtualcluster.database.windows.net%2010.0.1.254.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EHowever%2C%20when%20our%20customer%20tries%20to%20connect%20they%20faced%20the%20error%20message%20that%20we%20mentioned%20before.%20Why%3F%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EBy%20default%2C%20the%20connection%20policy%20of%20Azure%20SQL%20Managed%20Instance%20is%20configured%20as%20%22Default%22%20that%20means%20that%20if%20the%20client%20machine%20is%20running%20on%20Azure%2C%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-sql%2Fmanaged-instance%2Fconnection-types-overview%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3Ethe%20connection%20policy%20will%20be%20redirect%3C%2FA%3E.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20this%20redirection%20the%20client%20will%20connect%20directly%20to%20the%20node%20hosting%20the%20Managed%20Instance%20that%20has%20a%20specific%20name.%20Unfortunately%2C%20if%20the%20name%20of%20this%20node%20is%20not%20in%20the%20Custom%20DNS%20that%20our%20customer%20has%20the%20redirection%20will%20not%20be%20possible%20and%20you%20are%20going%20to%20have%20the%20error%20message%20that%20the%20node%20is%20unknown.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20this%20situation%2C%20we%20have%202%20different%20alternatives%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3ECustom%20DNS%3A%26nbsp%3B%3C%2FSTRONG%3E%3CUL%3E%0A%3CLI%3EAdd%20the%20name%20of%20the%20node%20in%20the%20Custom%20DNS.%20Unfortunately%2C%20it%20is%20quite%20complex%2C%20because%20we%20might%20have%20different%20nodes%20name%20and%20different%20IPs.%20For%20this%20reason%2C%20forward%20the%20request%20to%20the%20default%20Azure%20DNS%20will%20be%20a%20solution.%26nbsp%3B%3C%2FLI%3E%0A%3CLI%3EDon't%20use%20a%20Custom%20DNS%20for%20zone%20resolution%20.database.windows.net%20and%20add%26nbsp%3Bas%20a%20last%20Custom%20DNS%20server%20the%20IP%20of%20the%20default%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fvirtual-network%2Fwhat-is-ip-address-168-63-129-16%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3EAzure%20DNS%20server.%26nbsp%3B%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3EIf%20you%20want%20to%20know%20the%20name%20and%20the%20IP%20of%20this%20node%20you%20could%20take%20a%20network%20trace%20from%20the%20client%20machine.%20But%2C%20it%20is%20not%20a%20recommend%20solution.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EChange%20the%20connection%20policy%20to%20Proxy.%26nbsp%3B%3C%2FSTRONG%3E%3CUL%3E%0A%3CLI%3EIn%20this%20situation%2C%20the%20redirection%20will%20be%20not%20take%20place%20and%20you%20could%20connect%20normally.%26nbsp%3B%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EEnjoy!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-2121370%22%20slang%3D%22en-US%22%3E%3CP%3EToday%2C%20I%20worked%20on%20an%20interesting%20service%20request%20where%20our%20customer%20is%20facing%20the%20error%20message%20%22%3CSPAN%3E%3CSTRONG%3EConnection%20to%20database%20master%20failed%20(error%2011001%2C%20state%200)%3A%20A%20network-related%20or%20instance-specific%20error%20occurred%20while%20establishing%20a%20connection%20to%20SQL%20Server.%20The%20server%20was%20not%20found%20or%20was%20not%20accessible.%20Verify%20that%20the%20instance%20name%20is%20correct%20and%20that%20SQL%20Server%20is%20configured%20to%20allow%20remote%20connections.%20(provider%3A%20TCP%20Provider%2C%20error%3A%200%20-%20No%20such%20host%20is%20known.)%3C%2FSTRONG%3E%22%26nbsp%3B%3C%2FSPAN%3Etrying%20to%20connect%20to%20Azure%20SQL%20Managed%20Instance.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-TEASER%3E

Today, I worked on an interesting service request where our customer is facing the error message "Connection to database master failed (error 11001, state 0): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 0 - No such host is known.)trying to connect to Azure SQL Managed Instance. 

 

All points to that the issue is related about DNS resolution based on the message "No such host is known". In this situation, we saw that our customer created their own entry in their custom DNS to the .database.windows.net DNS Zone pointing to the name of the Azure SQL Managed Instance, for example, nameofmanagedinstance.virtualcluster.database.windows.net 10.0.1.254.

 

However, when our customer tries to connect they faced the error message that we mentioned before. Why? Because our customer is using Redirection

 

In this redirection the client will connect directly to the node hosting the Managed Instance that has a specific name. Unfortunately, if the name of this node is not in the Custom DNS that our customer has the redirection will not be possible and you are going to have the error message that the node is unknown. 

 

In this situation, we have 2 different alternatives:

 

  • Custom DNS: 
    • Add the name of the node in the Custom DNS. Unfortunately, it is quite complex, because we might have different nodes name and different IPs. For this reason, forward the request to the default Azure DNS will be a solution. 
    • Don't use a Custom DNS for zone resolution .database.windows.net and add as a last Custom DNS server the IP of the default Azure DNS server. 
    • If you want to know the name and the IP of this node you could take a network trace from the client machine. But, it is not a recommend solution.
  • Change the connection policy to Proxy. 
    • In this situation, the redirection will be not take place and you could connect normally. 

Enjoy!