question

Neha-5612 avatar image
0 Votes"
Neha-5612 asked ·

Unable to connect to Azure SQL DB from VM on Azure

I have created a new Azure SQL Server/DB and trying to connect to the Azure SQL DB from the windows VM that is in Azure, but getting network related error. I've added the VM's client IP in the Azure SQL firewall settings, but no luck. Here is the specific error ![77351-image.png][1] [1]: /answers/storage/attachments/77351-image.png

azure-sql-database
image.png (44.6 KiB)
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

learn2skills avatar image
0 Votes"
learn2skills answered ·

Hi @Neha-5612

Thank You for posting in Q & A.

Generally connecting from Azure VM to Azure SQL is a bit different then connecting from outside of Azure.

Connections from inside Azure
To allow applications hosted inside Azure to connect to your SQL server, Azure connections must be enabled. To enable Azure connections, there must be a firewall rule with starting and ending IP addresses set to 0.0.0.0.

  1. Troubleshoot the database firewall

  2. **Azure SQL DB Connectivity Troubleshooting**
    To check if you can reach the Port 1433, you can use multiple tools like TELNET / PSPING / POWERSHELL

Find below a simple test using Powershell

 Test-NetConnection -Port 1433 -ComputerName SERVERNAME.database.windows.net

You now will need to open firewall in the path from Server to Azure SQL DB, like Windows Firewall, Corporate Firewall and/or Azure NSG (Network security group) to allow this communication.

In this case for Azure VM will open NSG, and you can use Service Tags to simplify this configuration. With Service TAGs you do not need to hard code the SQL Gateway IPs.


Please don’t forget to Accept the answer and up-vote wherever the information provided helps you, this can be beneficial to other community members.


·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.