How to check connectivity to Azure SQL DB, Azure Database for MySQL and PostgreSQL


Scenario:

Sometimes when connection to Azure SQL DB, MySQL or PostgreSQL on Azure Database failed you want to test the network layer to confirm this is not network issue that prevents you from accessing your Azure SQL DB.

Note that this is relevant only for connections originated out of Azure as described here: Ports beyond 1433 for ADO.NET 4.5

Using these tests result in other than success as shown here means you have a network issue with accessing the server.

This test should succeed regardless of the firewall settings on the Azure SQL DB.

More information about troubleshooting connectivity can be found here: Troubleshooting Connectivity Common Scenarios

For Azure SQL DB use port 1433

For Azure Database for MySQL use port 3306

For Azure Database for PostgreSQL use port 5432

Using PowerShell (Recommended)

Use the following command to confirm you have true for the TcpTestSucceeded

 

Test-NetConnection <YourServerName>.database.windows.net -Port <TCPPort>

Using PsPing

Download the PsPing tool.

psping <YourServerName>.database.windows.net:<TCPPort>

 

Get current outbound IP address

Invoke-WebRequest ipinfo.io/ip | select Content | fl

Note: this method test the outbound IP for for 80 which is used for web browsing, in some scenario depend on your network topology can set different outbound IP for different TCP ports.


Comments (0)

Skip to main content