-
Notifications
You must be signed in to change notification settings - Fork 325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Azure SQL: Microsoft.Data.SqlClient - Invalid value for key 'authentication' #10357
Comments
Do you have an example of how you are connecting to the database? In the stack trace I see you are running AssemblyInitialize method, in which you can do anything. Are you using some feature provided by VSTest to do the authentication? |
I'm doing default code for Unit Testing and in which it has default code for the same: [AssemblyInitialize()]
public static void InitializeAssembly(TestContext ctx)
{
// Setup the test database based on setting in the
// configuration file
SqlDatabaseTestClass.TestService.DeployDatabaseProject();
SqlDatabaseTestClass.TestService.GenerateData();
} And below is the app.config code block which I use to connect to DB: <PrivilegedContext Provider="Microsoft.Data.SqlClient" ConnectionString="Server=.database.windows.net;Authentication=Active Directory Service Principal; Encrypt=True; Database=-dbname; User Id={appID}; Password={secret}" CommandTimeout="3000" /> Same code is working in my local Visual Studio. I can authenticate against AAD using SPN. |
I am trying to find who owns that library. |
Description
I'm trying to connect to Azure SQL Database with "Active Directory Service Principal", It failed with below error:
But Same code works fine with "Active Directory Password" mode.
It looks like, by default it only uses System.Data.SqlClient and we are not able to use Microsoft.Data.SqlClient
Steps to reproduce
Try to do auth with AAD using SPN:
Expected behavior
Authentication should work and it is working in local Visual Studio.
Actual behavior
Authentication should be successful with SPN AppID & Secret
Diagnostic logs
Environment
Azure DevOps Pipeline VSTest@3
vsTestVersion=latest
The text was updated successfully, but these errors were encountered: