Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Connection string for connecting to Azure SQL Database via Azure AD

How can I build connection string for connecting to Azure SQL Database using Azure AD account? Currently, I am using the following but it does not seem to be correct. It does not use Authentication Type: Active Directory Password.

Part of PowerShell script I am using:

server=$Server.database.windows.net;initial catalog=$Databasename;Authentication=Active Directory Password;Integrated Security=False;uid=$Username;password=$Password

I really appreciate your help.

like image 651
Maysam Jahromi Avatar asked May 14 '17 03:05

Maysam Jahromi


1 Answers

I managed to resolve the issue; It was actually the order of properties.

The following connection string worked

Data Source=$Server.database.windows.net;initial catalog=Master;User ID=$Username;password=$Password;authentication=Active Directory Password

However, this does not work

Data Source=$Server.database.windows.net;initial catalog=Master;authentication=Active Directory Password;User ID=$Username;password=$Password

The only difference is the order of "Authentication" tag. I never thought order of properties matter in ConnectionString.

like image 147
Maysam Jahromi Avatar answered Nov 09 '22 12:11

Maysam Jahromi