Reputation: 12368
I am new to analysis services on azure and trying to query it using AdomdClient
. I downloaded the latest client libraries from here :
https://learn.microsoft.com/en-us/azure/analysis-services/analysis-services-data-providers
What I tried :
Microsoft.IdentityModel.Clients.ActiveDirectory
with version higher than 2.8However while connecting to the instance in C#
using (var conn
= new Microsoft.AnalysisServices.AdomdClient.AdomdConnection(
ConfigurationManager.ConnectionStrings["dax"].ConnectionString))
{
conn.Open();
conn.Close();
}
I get the following error :
"Message": "An error has occurred.",
"ExceptionMessage": "Authentication failed: Microsoft.IdentityModel.Clients.ActiveDirectory failed to load 'Microsoft.IdentityModel.Clients.ActiveDirectory.PromptBehavior type'.",
"ExceptionType": "Microsoft.AnalysisServices.AdomdClient.AdomdConnectionException",
"StackTrace": "
at Microsoft.AnalysisServices.AdomdClient.AdalRuntimeLibrary.LoadAndValidateType(Assembly assembly, String typeName)
at Microsoft.AnalysisServices.AdomdClient.AdalRuntimeLibrary.LoadAuthenticationContextTypes(Assembly assembly)
at Microsoft.AnalysisServices.AdomdClient.AdalRuntimeLibrary..ctor()
at Microsoft.AnalysisServices.AdomdClient.AdalRuntimeLibrary.get_Instance()
at Microsoft.AnalysisServices.AdomdClient.AadAuthenticator.AcquireToken(Uri dataSourceUri, String dataSource, String identityProvider, String userId, String password, Boolean useAdalCache)
at Microsoft.AnalysisServices.AdomdClient.XmlaClient.OpenHttpConnection(ConnectionInfo connectionInfo, Boolean& isSessionTokenNeeded)
at Microsoft.AnalysisServices.AdomdClient.XmlaClient.OpenConnection(ConnectionInfo connectionInfo, Boolean& isSessionTokenNeeded)
at Microsoft.AnalysisServices.AdomdClient.XmlaClient.Connect(ConnectionInfo connectionInfo, Boolean beginSession)
at Microsoft.AnalysisServices.AdomdClient.AdomdConnection.XmlaClientProvider.Connect(Boolean toIXMLA)
at Microsoft.AnalysisServices.AdomdClient.AdomdConnection.ConnectToXMLA(Boolean createSession, Boolean isHTTP)
at Microsoft.AnalysisServices.AdomdClient.AdomdConnection.Open()
at ...
Microsoft.IdentityModel.Clients.ActiveDirectory
since few of the nugets that I use explicitly restrict lowest version to 3.x which definitely changed the Microsoft.IdentityModel.Clients.ActiveDirectory.PromptBehavior
that comes up in the error.Is there a way around this ?
Upvotes: 4
Views: 1507
Reputation: 11
I had a similar issue. While other projects in my solution referred to ActiveDirectory versions > 3.0, AdomdClient needs <2.8. Adding a binding redirect like below to the app.config fixed my problem. This will let other dlls use >3.0 versions of ActiveDirectory, but AdomdClient can use 2.8.x
<dependentAssembly>
<assemblyIdentity name="Microsoft.IdentityModel.Clients.ActiveDirectory" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="3.0.0.0-3.19.8.16603" newVersion="3.19.8.16603" />
</dependentAssembly>
Upvotes: 1