Issue:
When connecting from inside Azure (an Azure Virtual Machine) to Azure SQL Server. All connections failed with error:
MSSQLSERVER_10060 - SQL Server | Microsoft Docs
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 - A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.) (.Net SqlClient Data Provider)
------------------------------
For help, click: https://docs.microsoft.com/sql/relational-databases/errors-events/mssqlserver-10060-database-engine-error
------------------------------
Error Number: 10060
Severity: 20
State: 0
Scenario:
All connections are via the Private Endpoint, after disabling the public access (Public Endpoint) on the Database. As per the screenshot below (Azure Portal -->Azure SQL Server--> Networking):
Troubleshooting steps:
Run Connectivity checker PowerShell script , you can find the script on below URL:
Part of the script is validating the DNS resolution of Azure SQL Server FQDN. Below is part of the script execution result:
Validating DNS record for mysqlservername.database.windows.net
Could not find DNS record in local cache (while excluding hosts file)
Could not find DNS record in local cache (while including hosts file)
Found DNS record in DNS server (IP Address:104.40.168.105)
Error getting DNS record in Open DNS (mysqlservername.database.windows.net : This operation returned because the timeout period expired)
The IP address 104.40.168.105 is one of the listed Public gateway IP addresses, as per below URL:
So, the DNS is resolving the Public IP of the Gateway not the private endpoint IP.
Resolution:
Fix the internal naming resolution service error. For more information: