Search code examples
c#azureazure-analysis-services

How to Connect to Azure Analysis Services from C#?


I'm learning about Azure Analysis Services and I need to build a C# application to query data on Azure Analysis Services

I have difficulties finding resources, most cover SSAS and not applied to AAS!

Last try now is:

Microsoft.AnalysisServices.Tabular.Server asSrv = new Microsoft.AnalysisServices.Tabular.Server();

asSrv.Connect(@"Password=<password>;Persist Security Info=True;User ID=<email>@hotmail.com;Data Source=asazure://westeurope.asazure.windows.net/<servername>");

This is to try processing data for example, but I'm receiving error:

Object reference not set to an instance of an object.

(Source: Microsoft.AnalysisServices.Core)

Stack Trace:

at Microsoft.AnalysisServices.HttpStream.ImpersonateLogonIdentityAndExecute(Action action)
   at Microsoft.AnalysisServices.HttpStream.GetResponseStream()
   at Microsoft.AnalysisServices.HttpStream.GetResponseDataType()
   at Microsoft.AnalysisServices.CompressedStream.GetResponseDataType()
   at Microsoft.AnalysisServices.XmlaClient.EndRequest(Boolean useBinaryXml)
   at Microsoft.AnalysisServices.XmlaClient.CreateSession(ListDictionary properties, Boolean sendNamespaceCompatibility, String sessionToken)
   at Microsoft.AnalysisServices.XmlaClient.Connect(ConnectionInfo connectionInfo, Boolean beginSession)
   at Microsoft.AnalysisServices.Core.Server.Connect(String connectionString, String sessionId, ObjectExpansion expansionType)
   at Microsoft.AnalysisServices.Core.Server.Connect(String connectionString)
   at ConnectToAAS.Form1.button4_Click(Object sender, EventArgs e) in D:\Projects\Azure Analysis Services\ConnectToAAS\ConnectToAAS\Form1.cs:line 150

could anyone please give links for "WORKING" examples for how to connect and how to query?!

And I need to connect silently without popup login pages.

Thanks in advance..


Solution

  • I searched for dlls in C: drive by my self, copied them to bin directory and referenced them, and it works!!!

    The problem now is how to authenticate without prompting Microsoft account login