Sandip Bantawa
Sandip Bantawa

Reputation: 2880

Unable to connect with Azure SQL from Azure VM using Site-Site Connectivity

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:

  1. Added VM's public IP in remote database server
  2. Added Endpoints for 1433 TCP thru Azure Dashboard
  3. Added Inbound rule for 1433 in VM' Firewall

EDIT

For site-to-site VPN,

  1. we linked our database to cloud service of VM
  2. traced IP of database, now we are able to telnet IP with 1433 within VM.

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

Answers (2)

Sandip Bantawa
Sandip Bantawa

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

Yochanan Rachamim
Yochanan Rachamim

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

Related Questions