Azure SQL Azure AD Authentication Failure

2019-04-12 08:42发布

问题:

I am trying to connect to my Azure SQL Database that has a Azure Active Directory Database Contained User from my .NET Application (Sitecore). I have the adalsql.dll installed on the VM hosting the .NET Application. However, when I attempt to connect, I receive the following error:

Failed to authenticate the user test@mytest.onmicrosoft.com in Active Directory (Authentication=ActiveDirectoryPassword). Error code 0xCAA20064; state 10 AADSTS50055: Force Change Password.

Here is my connectionString:

<add name="mydb" connectionString="Data Source=test.database.windows.net,1433;Initial Catalog=TEST_DB;Persist Security Info=False;User ID=test@mytest.onmicrosoft.com;Password=12345;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Authentication=Active Directory Password" />

回答1:

Resetting the user password did the trick. I had to login to the Azure Portal after going into Azure Active Directory and selecting reset password.