通过Azure AD连接到Azure SQL数据库的连接字符串 [英] Connection string for connecting to Azure SQL Database via Azure AD
问题描述
如何构建使用Azure AD帐户连接到Azure SQL数据库的连接字符串? 目前,我正在使用以下内容,但它似乎不正确.它不使用身份验证类型:Active Directory密码.
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.
我正在使用的PowerShell脚本的一部分:
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 managed to resolve the issue; It was actually the order of properties.
以下连接字符串有效
Data Source=$Server.database.windows.net;initial catalog=Master;User ID=$Username;password=$Password;authentication=Active Directory Password
但是,这不起作用
Data Source=$Server.database.windows.net;initial catalog=Master;authentication=Active Directory Password;User ID=$Username;password=$Password
唯一的区别是身份验证"标签的顺序.
我从没想到ConnectionString
中属性的顺序很重要.
The only difference is the order of "Authentication" tag.
I never thought order of properties matter in ConnectionString
.
这篇关于通过Azure AD连接到Azure SQL数据库的连接字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!