5

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.

1
  • I followed the sample provided by Microsoft in learn.microsoft.com/en-us/azure/sql-database/… However, this does not work; I am using powershell to create registered servers and the sample connection string does not work there. Commented May 14, 2017 at 3:49

2 Answers 2

4

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.

Sign up to request clarification or add additional context in comments.

Comments

0

In the example, they use this format:

Data Source=n9lxnyuzhv.database.windows.net; 
Authentication=Active Directory Password; 
Initial Catalog=testdb;  
[email protected]; 
PWD=MyPassWord!";

So try to use PWD instead of Password.

1 Comment

Brandi Thanks for your comment. I actually tried that format: “Data Source=$Server.database.windows.net;Authentication=Active Directory Password;initial catalog=Master;UID=$Username;PWD=$Password” However, it did not even populate password in "Registered Servers" in SQL Server.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.