Reputation: 2880
We have created simple classic Azure VM and have Azure SQL.
We have an application running on VM and trying to do some operation on Azure SQL, however we are not able to access it and got generic exception
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
We already did list of things:
EDIT
For site-to-site VPN,
But still we are logging below error on logger when trying to interact with database.
A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 0 - The target principal name is incorrect.
Are we missing something here
Upvotes: 1
Views: 2266
Reputation: 2880
Facepalm moment for us.
Our internet wasn't working that is why we weren't able to connect to our database. As per web we did add MSFT's public DNS Servers i.e. 168.63.129.16 and 168.62.167.9. for classic VM's configure tab.
Upvotes: 0
Reputation: 131
Generally connecting from Azure VM to Azure SQL is a bit different then connecting from outside of Azure.
assuming you are using the latest V12 Azure SQL and latest .Net framework or SSMS
you need to open on your VM outbound connection with TCP port range 11000-11999 and 14000-14999 make sure you do not have any blocker (firewall, 3rd party application that uses this port ranges)
from the Azure SQL end you can just click on "Allow Azure Services" on the Firewall configuration blade to allow connection from within Azure
you can read more about ports used when connecting to Azure SQL here: https://azure.microsoft.com/en-in/documentation/articles/sql-database-develop-direct-route-ports-adonet-v12/
and regards the Firewall configuration on Azure SQL you can read more here: https://azure.microsoft.com/en-in/documentation/articles/sql-database-firewall-configure/#connecting-from-azure
Upvotes: 1