Home
%3CLINGO-SUB%20id%3D%22lingo-sub-368915%22%20slang%3D%22en-US%22%3EHow%20to%20check%20connectivity%20to%20Azure%20SQL%20DB%2C%20Managed%20Instance%2C%20Azure%20Database%20for%20MySQL%20and%20PostgreSQL%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-368915%22%20slang%3D%22en-US%22%3E%0A%20%26lt%3Bmeta%20http-equiv%3D%22Content-Type%22%20content%3D%22text%2Fhtml%3B%20charset%3DUTF-8%22%20%2F%26gt%3B%3CSTRONG%3E%20First%20published%20on%20MSDN%20on%20Jul%2017%2C%202017%20%3C%2FSTRONG%3E%20%3CBR%20%2F%3E%3CH2%20id%3D%22toc-hId-1710425125%22%20id%3D%22toc-hId-1710425125%22%3EScenario%3A%3C%2FH2%3E%3CBR%20%2F%3E%20Sometimes%20when%20connection%20to%20Azure%20SQL%20DB%2C%20Managed%20Instance%2C%20MySQL%20or%20PostgreSQL%20on%20Azure%20Database%20failed%20you%20want%20to%20test%20the%20network%20layer%20to%20confirm%20this%20is%20not%20network%20issue%20that%20prevents%20you%20from%20accessing%20your%20Azure%20DB%20service.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20Note%20that%20this%20is%20manly%20relevant%20for%20connections%20originated%20out%20of%20Azure%20as%20described%20here%3A%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fsql-database%2Fsql-database-develop-direct-route-ports-adonet-v12%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3E%20Ports%20beyond%201433%20for%20ADO.NET%204.5%20%3C%2FA%3E%20However%2C%20this%20test%20should%20be%20successful%20from%20within%20Azure%20as%20well.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20For%20Managed%20Instance%20read%20more%20about%20connect%20you%20application%20here%3A%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fsql-database%2Fsql-database-managed-instance-connect-app%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3E%20Connect%20your%20application%20to%20Azure%20SQL%20Database%20Managed%20Instance%20%3C%2FA%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20Using%20these%20tests%20result%20in%20other%20than%20success%20as%20shown%20here%20means%20you%20have%20a%20network%20issue%20with%20accessing%20the%20server.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20This%20test%20should%20succeed%20regardless%20of%20the%20firewall%20settings%20on%20the%20Azure%20SQL%20DB.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20More%20information%20about%20troubleshooting%20connectivity%20can%20be%20found%20here%3A%20%3CA%20href%3D%22https%3A%2F%2Fblogs.msdn.microsoft.com%2Fazuresqldbsupport%2F2017%2F06%2F27%2Ftroubleshooting-connectivity-common-scenarios%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3E%20Troubleshooting%20Connectivity%20Common%20Scenarios%20%3C%2FA%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20For%20Azure%20%3CSTRONG%3E%20SQL%20DB%20%3C%2FSTRONG%3E%20use%20port%20%3CSTRONG%3E%201433%20%3C%2FSTRONG%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20for%20%3CSTRONG%3E%20Managed%20Instance%20%3C%2FSTRONG%3E%20please%20use%20the%20FQDN%20of%20your%20instance.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20For%20Azure%20Database%20for%20%3CSTRONG%3E%20MySQL%20%3C%2FSTRONG%3E%20use%20port%20%3CSTRONG%3E%203306%20%3C%2FSTRONG%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20For%20Azure%20Database%20for%20%3CSTRONG%3E%20PostgreSQL%20%3C%2FSTRONG%3E%20use%20port%20%3CSTRONG%3E%205432%3C%2FSTRONG%3E%20%3CBR%20%2F%3E%3CH2%20id%3D%22toc-hId--841731836%22%20id%3D%22toc-hId--841731836%22%3EUsing%20PowerShell%20(Recommended)%3C%2FH2%3E%3CBR%20%2F%3E%20Use%20the%20following%20command%20to%20confirm%20you%20have%20true%20for%20the%20TcpTestSucceeded%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CSTRONG%3E%20Test-NetConnection%20%3CYOURSERVERNAME%3E.database.windows.net%20-Port%20%3CTCPPORT%3E%3C%2FTCPPORT%3E%3C%2FYOURSERVERNAME%3E%3C%2FSTRONG%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20style%3D%22width%3A%20652px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F88943i5AB8ED0E1D0D7A2A%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20%2F%3E%3C%2FSPAN%3E%20%3CBR%20%2F%3E%3CH2%20id%3D%22toc-hId-901078499%22%20id%3D%22toc-hId-901078499%22%3EUsing%20PsPing%3C%2FH2%3E%3CBR%20%2F%3E%20Download%20the%20%3CA%20href%3D%22https%3A%2F%2Ftechnet.microsoft.com%2Fen-us%2Fsysinternals%2Fpsping.aspx%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3E%20PsPing%20%3C%2FA%3E%20tool.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CSTRONG%3E%20psping%20%3CYOURSERVERNAME%3E.database.windows.net%3A%3CTCPPORT%3E%20%3CBR%20%2F%3E%20%3C%2FTCPPORT%3E%3C%2FYOURSERVERNAME%3E%3C%2FSTRONG%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20style%3D%22width%3A%20801px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F88944iEC0290164B76F925%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20%2F%3E%3C%2FSPAN%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%3CH2%20id%3D%22toc-hId--1651078462%22%20id%3D%22toc-hId--1651078462%22%3EGet%20current%20outbound%20IP%20address%3C%2FH2%3E%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20Invoke-WebRequest%20ipinfo.io%2Fip%20%7C%20select%20Content%20%7C%20fl%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSTRONG%3ENote%20%3C%2FSTRONG%3E%3A%20this%20method%20test%20the%20outbound%20IP%20for%20for%2080%20which%20is%20used%20for%20web%20browsing%2C%20in%20some%20scenario%20depend%20on%20your%20network%20topology%20can%20set%20different%20outbound%20IP%20for%20different%20TCP%20ports.%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-368915%22%20slang%3D%22en-US%22%3E%3CP%3EFirst%20published%20on%20MSDN%20on%20Jul%2017%2C%202017%20Scenario%3ASometimes%20when%20connection%20to%20Azure%20SQL%20DB%2C%20Managed%20Instance%2C%20MySQL%20or%20PostgreSQL%20on%20Azure%20Database%20failed%20you%20want%20to%20test%20the%20network%20layer%20to%20confirm%20this%20is%20not%20network%20issue%20that%20prevents%20you%20from%20accessing%20your%20Azure%20DB%20service.%3C%2FP%3E%3C%2FLINGO-TEASER%3E
Microsoft
First published on MSDN on Jul 17, 2017

Scenario:


Sometimes when connection to Azure SQL DB, Managed Instance, 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 DB service.

Note that this is manly relevant for connections originated out of Azure as described here: Ports beyond 1433 for ADO.NET 4.5 However, this test should be successful from within Azure as well.

For Managed Instance read more about connect you application here: Connect your application to Azure SQL Database Managed Instance

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 Managed Instance please use the FQDN of your instance.

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.