Connecting to Azure SQL Database
You can connect to the Azure SQL Database used by the Management Server in several ways:
Via Query Editor on Azure portal.
With your favorite tool such as Azure Data Studio.
With
sqlcmdIf not installed yet, install sqlcmd from https://github.com/microsoft/go-sqlcmd/releases
apt-get install bzip2wget https://github.com/microsoft/go-sqlcmd/releases/download/v1.8.2/sqlcmd-linux-amd64.tar.bz2 -O /tmp/sqlcmd.tar.bz2tar -xjf /tmp/sqlcmd.tar.bz2 -C /usr/local/bin/chmod +x /usr/local/bin/sqlcmdOn your machine: you must have own an account on the database server. For example:
sqlcmd -S <SQL server URL> -d <database name> \--authentication-method=ActiveDirectoryDeviceCodeFrom the SSH session to the App Service container: you can use application’s managed identity.
System-assigned:
env $(cat /proc/1/environ | tr '\0' '\n' | grep '^IDENTITY_' | xargs -0) \sqlcmd -S <SQL server URL> -d <database name> \--authentication-method=ActiveDirectoryManagedIdentityUser-assigned: add
-Uflag set to client ID of the managed identity (oruservalue from the DB connection string):env $(cat /proc/1/environ | tr '\0' '\n' | grep '^IDENTITY_' | xargs -0) \sqlcmd -S <SQL server URL> -d <database name> \--authentication-method=ActiveDirectoryManagedIdentity \-U <ideneity-client-id>