用于通过 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
唯一的区别是Authentication"标签的顺序.我从没想过ConnectionString
中的属性顺序很重要.
The only difference is the order of "Authentication" tag.
I never thought order of properties matter in ConnectionString
.
这篇关于用于通过 Azure AD 连接到 Azure SQL 数据库的连接字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!