[英]“Keyword not supported: authentication” when using Active Directory Password against AAD in Azure Web App
I'm have an Azure Web App where I've set the connection string to point to an Azure SQL DB. 我有一个Azure Web App,其中已将连接字符串设置为指向Azure SQL DB。 I'd prefer to use an Azure Active Directory username/password for authentication so I used the following connection string:
我希望使用Azure Active Directory用户名/密码进行身份验证,因此我使用了以下连接字符串:
Server=tcp:mydb.database.windows.net,1433;Initial Catalog=mytable;Persist Security Info=False;User ID={your_username};Password={your_password};MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Authentication="Active Directory Password";
This causes my app to fail with the error: 这导致我的应用失败,并显示以下错误:
Keyword not supported: 'authentication'
If I use the SQL Authentication (ie remove the Authentication="Active Directory Password"
and change User ID
and Password
to an appropriate SQL username and password), everything works as expected. 如果我使用SQL身份验证(即删除
Authentication="Active Directory Password"
,并将User ID
和Password
更改为适当的SQL用户名和密码),那么一切都会按预期进行。
Is it possible to use Active Directory Password
with an Azure Web App connection string in order to use an AAD username/password to connect to an Azure SQL Db? 是否可以将
Active Directory Password
与Azure Web App连接字符串一起使用,以便使用AAD用户名/密码连接到Azure SQL Db?
Please change the connection string as shown below: 请如下所示更改连接字符串:
string ConnectionString =
@"Data Source=n9lxnyuzhv.database.windows.net; Authentication=Active Directory Password; Initial Catalog=testdb; UID=bob@contoso.onmicrosoft.com; PWD=MyPassWord!";
SqlConnection conn = new SqlConnection(ConnectionString);
conn.Open();
Another option: 另外一个选项:
string ConnectionString =
@"Data Source=n9lxnyuzhv.database.windows.net; Authentication=Active Directory Integrated; Initial Catalog=testdb;";
SqlConnection conn = new SqlConnection(ConnectionString);
conn.Open();
Please note the text following the Authentication keyword. 请注意Authentication关键字后面的文本。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.