Skip to content
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

OpenConnectionForKey with Active Directory administrator not working #172

Open
ms92ita opened this issue Apr 6, 2018 · 0 comments
Open

Comments

@ms92ita
Copy link

ms92ita commented Apr 6, 2018

Hi guys,

I am trying to edit my application in order to use the Active Directory administrator from Azure SQL Server.
With a simple db connection it all works fine, but when I'm trying to get the connection for a single shard with OpenConnectionForKey (in order to get the connection for a DbContext), the login is not working and i receive this message: "Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON".
I'm using 1.3.3 version of library with project targeting to 4.6.2
Here it is the code example:
private static DbConnection CreateShardConnection(ShardMap shardMap, int shardingKey, string connectionStr, bool enlistPool) { // No initialization System.Data.Entity.Database.SetInitializer<BF6Context>(null); var cStr = new SqlConnectionStringBuilder(connectionStr); cStr.MultipleActiveResultSets = true; cStr.Enlist = enlistPool; // Ask shard map to broker a validated connection for the given key return shardMap.OpenConnectionForKey<int>(shardingKey, cStr.ConnectionString, ConnectionOptions.Validate); // No initialization System.Data.Entity.Database.SetInitializer<BF6Context>(null); var cStr = new SqlConnectionStringBuilder(connectionStr); cStr.MultipleActiveResultSets = true; cStr.Enlist = enlistPool; // Ask shard map to broker a validated connection for the given key return shardMap.OpenConnectionForKey<int>(shardingKey, cStr.ConnectionString, ConnectionOptions.Validate); }

An example of the connection string that I am trying to inject is:

Persist Security Info=True;User ID=dbadmin@domain.com;Password=strongpassword;Enlist=True;Max Pool Size=6000;MultipleActiveResultSets=True;Connect Timeout=30;Encrypt=True;Authentication="Active Directory Password";Application Name=elasticdbapplication

Previously I had 1.3.0 version library and I've read from this issue (#123) that the target version for Active Directory Authentication is 1.3.2, but with no result as you can see.

Any help is really appreciated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant