Notes for using Microsoft SQL Server on Azure (Connect 2024)

When using a Microsoft SQL Server database hosted on Azure, the connection string in the appsettings.json file must be configured as follows:

Authentication using Azure Active Directory

In this scenario, the login requires an Active Directory user with multi-factor authentication disabled. The schema for the connection string:

Server=tcp:[SERVER_NAME],[SERVER_PORT];Database=[DB_NAME]Authentication=Active Directory Password;UID=[USER_NAME];PWD=[PASSWORD];Trusted_Connection=False;Encrypt=True;

The components shown in italics must be replaced as follows:

SERVER_NAME

[SERVER_NAME]

The host name used to connect to the SQL server. This usually ends with ".database.windows.net".

[SERVER_PORT]

The port used to connect to the SQL server. Usually this is port 1433.

[DB_NAME]

The name of the database to connect to.

[USER_NAME]

The name of the Azure AD user to use.

[PASSWORD]

The password of the Azure AD user to be used.

Authentication using SQL Server Authentication

In this scenario, an SQL Server user with appropriate privileges must be created for the login. The schema for the connection string:

Server=tcp:[SERVER_NAME],[SERVER_PORT];Database=[DB_NAME];User ID=[USER_NAME];Password=[PASSWORD];Trusted_Connection=False;Encrypt=True;

The components shown in italics must be replaced as follows:

SERVER_NAME

[SERVER_NAME]

The host name used to connect to the SQL server. This usually ends with ".database.windows.net".

[SERVER_PORT]

The port used to connect to the SQL server. Usually this is port 1433.

[DB_NAME]

The name of the database to connect to.

[USER_NAME]

The name of the SQL server user to use.

[PASSWORD]

The password of the SQL Server user to be used.