Reputation: 937
I have an Azure analysis service model which I am trying to query from an Azure Web API/ Azure Functions using ADOMD and Dax queries. I am not able to find any nuget packages which can work with Azure Analysis server & the only thing I can find is below:
https://learn.microsoft.com/en-us/azure/analysis-services/analysis-services-connect
I followed the above post & installed the client components and I am able to connect to Azure AS from my local computer using a console app. But my end goal is to connect to Azure AS from an Azure WebAPI and AFAIK I won't be able to install the client components there. Please share any info if you have worked in Azure Analysis service + Azure Web APIs.
Thanks
Upvotes: 1
Views: 1208
Reputation: 937
Just tested it out in Azure WEB APIs and ADOMD works by just adding reference to latest Microsoft.AnalysisServices.AdomdClient dll (Version:14.0.0.0). Sample code:
var connectionString = $"Provider=MSOLAP;Data Source=asazure://<azure location>.asazure.windows.net/<SSAS name>;Initial Catalog=adventureworks;User ID=<userid>;Password=****;Persist Security Info=True;Impersonation Level=Impersonate";
var ssasConnection = new AdomdConnection(connectionString);
ssasConnection.Open();
var query = @"EVALUATE(Customer)";
var cmd = new AdomdCommand(query)
{
Connection = ssasConnection
};
using (var reader = cmd.ExecuteReader())
{
while (reader.Read())
{
for (var i=0;i<reader.FieldCount;i++)
{
Console.WriteLine(reader[i]);
}
break;
}
}
My blog about the same: https://unnieayilliath.com/2017/11/12/connecting-to-azure-analysis-services-using-adomd/
Upvotes: 1
Reputation: 18465
AFAIK, Azure Web Apps run in a secure environment called the sandbox. You could not install any components. Per my understanding, you could install the latest providers on your side, then manually copy Microsoft.AnalysisServices.Tabular.DLL
and Microsoft.AnalysisServices.Tabular.DLL
to your console application and add as the reference to your project for connecting to Azure Analysis Services. Here is a code sample, you could refer to here.
For Azure web app, I assumed that you could reference the above two libs and connect to Azure Analysis service. Moreover, you could use azure functions working with Azure Analysis service, for more detailed tutorial, you could refer to this official blog here.
Upvotes: 0