Testing SQL connection for Azure App

How to Test SQL connection for orchestrator hosted on Azure PaaS environment.

Prerequisites

  • Access to the Azure portal.
  • Necessary permissions to access the Azure SQL database.
  • Connection string for the Azure SQL database.

Resolution

  1. Access Azure Portal.
  2. Navigate to Your App Service.
  3. Open the Console.
  4. Test SQL Connection Using SQLCMD
  • Ensure sqlcmd is available in your App Service environment. If not, you will need to install it (installation steps may vary depending on your setup and are not covered here).

sqlcmd -S .database.windows.net -d -U -P -Q "SELECT 1"

  • -S .database.windows.net: Specifies the server name of your Azure SQL Database. Replace with the actual server name.
  • -d : Specifies the name of the database you want to connect to. Replace with the actual database name.
  • -U : Specifies the username for authentication. Replace with your actual username.
  • -P : Specifies the password for the provided username. Replace with the actual password.
  • -Q "SELECT 1": Executes the query SELECT 1, which is a simple query that returns the number 1 to confirm that the connection is working.
  • Make sure to replace the placeholders with your actual server, database, username, and password details. Also, ensure that sqlcmd is installed and properly configured on your system.
  1. Verify the Output
  • If the connection is successful, you should see output as 1, otherwise it will give the error.