- Supports Public Cloud (\*.database.windows.net), Azure China (\*.database.chinacloudapi.cn), Azure Germany (\*.database.cloudapi.de) and Azure Government (\*.database.usgovcloudapi.net).
# Supports Public Cloud (*.database.windows.net), Azure China (*.database.chinacloudapi.cn), Azure Germany (*.database.cloudapi.de) and Azure Government (*.database.usgovcloudapi.net)
RunAdvancedConnectivityPolicyTests = $true # Set as $true (default) or $false, this will load the library from Microsoft's GitHub repository needed for running advanced connectivity tests
CollectNetworkTrace = $true # Set as $true (default) or $false
#EncryptionProtocol = '' # Supported values: 'Tls 1.0', 'Tls 1.1', 'Tls 1.2'; Without this parameter operating system will choose the best protocol to use
Write-Host 'or use a machine with Internet access to see how to run this from machines without Internet. See how at https://github.com/Azure/SQL-Connectivity-Checker/' -ForegroundColor Yellow
Results are displayed in the output window. If the user has permissions to create folders, a folder with the resulting log file will be created, along with a ZIP file (`AllFiles.zip`). When running on Windows, the folder opens automatically after the script completes.
6. Examine the output for any issues detected, and recommended steps to resolve the issue.
## Run from Linux
With the current release, PowerShell uses .NET 5.0 as its runtime. PowerShell runs on Windows, macOS, and Linux platforms.
1. In order to run this script on Linux you need to installing PowerShell on Linux (if you haven't before).
See how to get the packages at https://docs.microsoft.com/powershell/scripting/install/installing-powershell-core-on-linux
2. After the package is installed, run pwsh from a terminal.
3. Set the parameters on the following script then copy paste it to the terminal. You must set the server name and database name. User and password are optional, but best practices.
```powershell
$parameters = @{
# Supports Single, Elastic Pools and Managed Instance (please provide FQDN, MI public endpoint is supported)
# Supports Public Cloud (*.database.windows.net), Azure China (*.database.chinacloudapi.cn), Azure Germany (*.database.cloudapi.de) and Azure Government (*.database.usgovcloudapi.net)
Server = '.database.windows.net' # or any other supported FQDN
Database = '' # Set the name of the database you wish to test, 'master' will be used by default if nothing is set
User = '' # Set the login username you wish to use, 'AzSQLConnCheckerUser' will be used by default if nothing is set
Password = '' # Set the login password you wish to use, 'AzSQLConnCheckerPassword' will be used by default if nothing is set
## Optional parameters (default values will be used if omitted)
SendAnonymousUsageData = $true # Set as $true (default) or $false
RunAdvancedConnectivityPolicyTests = $true # Set as $true (default) or $false, this will load the library from Microsoft's GitHub repository needed for running advanced connectivity tests
ConnectionAttempts = 1 # Number of connection attempts while running advanced connectivity tests
DelayBetweenConnections = 1 # Number of seconds to wait between connection attempts while running advanced connectivity tests
CollectNetworkTrace = $true # Set as $true (default) or $false
#EncryptionProtocol = '' # Supported values: 'Tls 1.0', 'Tls 1.1', 'Tls 1.2'; Without this parameter operating system will choose the best protocol to use
}
$ProgressPreference = "SilentlyContinue";
if ("AzureKudu" -eq $env:DOTNET_CLI_TELEMETRY_PROFILE) {
Write-Host 'ERROR: The script file could not be downloaded:' -ForegroundColor Red
$_.Exception
Write-Host 'Confirm this machine can access https://github.com/Azure/SQL-Connectivity-Checker/' -ForegroundColor Yellow
Write-Host 'or use a machine with Internet access to see how to run this from machines without Internet. See how at https://github.com/Azure/SQL-Connectivity-Checker/' -ForegroundColor Yellow
}
#end
```
5. Examine the output for any issues detected, and recommended steps to resolve the issue.
## How to run this from machines whithout Internet access
**In order to run it from machines without Internet access you need to:**
1. From a machine with Internet access
- Navigate to https://github.com/Azure/SQL-Connectivity-Checker
- Click on the green button named 'Clone or download'
- Select 'Download ZIP'
1. Copy the 'SQL-Connectivity-Checker-master.zip' file to the machine you need to run tests from.
1. Extract all the files into a folder.
1. Open Windows PowerShell ISE in Administrator mode.
For the better results, our recommendation is to use the advanced connectivity tests which demand to start PowerShell in Administrator mode. You can still run the basic tests, in case you decide not to run this way. Please note that script parameters 'RunAdvancedConnectivityPolicyTests' and 'CollectNetworkTrace' will only work if the admin privileges are granted.
1. From PowerShell ISE, open the file named 'RunLocally.ps1' you can find in the previous folder.
1. Set the parameters on the script, you need to set server name. Database name, user and password are optional but desirable.
1. Save the changes.
1. Click Run Script (play button). You cannot run this partially or copy paste to the command line.
1. The results can be seen in the output window.
If the user has the permissions to create folders, a folder with the resulting log file will be created.
When running on Windows, the folder will be opened automatically after the script completes.
A zip file with all the log files (AllFiles.zip) will be created.
## Running SQL Connectivity Checker in containerized environment
In order to troubleshoot your containerized application you'll have to temporarily deploy a Powershell Image which will allow you to execute this script and collect the results, you can see all the available Powershell Images [here](https://hub.docker.com/_/microsoft-powershell).
Our suggestion would be to use a lightweight image for this purpose, such as `lts-alpine-3.10` image.