简体   繁体   中英

WSTrust error using .NET framework 4.8 to connect to Azure SQL using Active Directory Password

I have a console application that uses .NET Framework 4.8, and I need it to connect to an Azure SQL database, I have simplified the issue to the following sample:

using(var con = new SqlConnection(myConnectionString)) {
    con.Open();
    // ...
}

...where the connection string takes the form:

Server=MyDbAddressHere;Initial Catalog=MyDbName;Persist Security Info=False;User ID=MyUsername;Password=MyPassword;MultipleActiveResultSets=False;Encrypt=True;TrueServerCertificate=False;Authentication=Active Directory Password;

I am getting an exception when opening the connection:

AdalException: WSTrust response does not have recognized SAML assertion.

I'm not sure how to interpret the error I'm getting, and how to go about fixing it so I can connect to the database and use it.

Changing the password solved the problem; apparently it had something to do with the account recently having been changed to no longer require MFA.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM