Azure / Azure/elastic-db-tools
OpenConnectionForKey with Active Directory administrator not working
- Dominant language
- C#
- Stars
- 147
- Forks
- 108
- PR merge metrics
- No merged PRs in 30d
Description
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(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(shardingKey, cStr.ConnectionString, ConnectionOptions.Validate);
// No initialization
System.Data.Entity.Database.SetInitializer(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(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 (https://github.com/Azure/elastic-db-tools/issues/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
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.