Check connectivity to Azure SQL Database using Azure PowerShell

This comes in handy to see if the customer is able to connect to the database server or not. In other words, if you want to check if the database connection can be reached to the server or not can be found by performing a small test.


If (New-Object System.Net.Sockets.TCPClient -ArgumentList 'xxxxxxxxxxx.database.windows.net',1433) { Write-Host 'YES' } If ($? -eq $false) { Write-Host 'NO' }


One of my customers has an intermittent issue with connectivity within an Azure VM. 

See the screenshot below:

 

Above picture shows, the customer was not able to connect intermittently to the same server. 

-KKB