title: Error connecting to Azure Analysis Services
body: <p>I am new to analysis services on azure and trying to query it using <code>AdomdClient</code>. I downloaded the latest client libraries from here :</p>
  
  <blockquote>
    <p><a href="https://docs.microsoft.com/en-us/azure/analysis-services/analysis-services-data-providers" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/azure/analysis-services/analysis-services-data-providers</a></p>
  </blockquote>
  
  <p>What I tried :</p>
  
  <ul>
  <li>I am able to connect to the model from SSMS after I installed the necessary SQL Server Data Tools.</li>
  <li>I am able to connect and query without any issue in a simple WebApi with no other dependency using reference to the client libraries</li>
  <li>I am NOT able to connect and query when the project has a dependency to <code>Microsoft.IdentityModel.Clients.ActiveDirectory</code> with version higher than 2.8</li>
  </ul>
  
  <p>However while connecting to the instance in C#</p>
  
  <pre><code>        using (var conn 
          = new Microsoft.AnalysisServices.AdomdClient.AdomdConnection(
              ConfigurationManager.ConnectionStrings["dax"].ConnectionString))
          {
              conn.Open();
  
              conn.Close();
          }
  </code></pre>
  
  <p>I get the following error :</p>
  
  <pre><code>"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&amp; isSessionTokenNeeded)
     at Microsoft.AnalysisServices.AdomdClient.XmlaClient.OpenConnection(ConnectionInfo connectionInfo, Boolean&amp; 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 ...
  </code></pre>
  
  <ul>
  <li>After little bit of digging a bunch of us realized the AdomdClient dll has a reference to an embedded ActiveDirectory dll inside the dll which references version 2.8.*</li>
  <li>I cannot lower the version to <code>Microsoft.IdentityModel.Clients.ActiveDirectory</code> since few of the nugets that I use explicitly restrict lowest version to 3.x which definitely changed the <code>Microsoft.IdentityModel.Clients.ActiveDirectory.PromptBehavior</code> that comes up in the error.</li>
  </ul>
  
  <p>Is there a way around this ? </p>