An Azure service that provides an enterprise-grade analytics engine.
Can anyone please share a whole working example.
Thanks in advance.
Note: am getting URL not found error.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi All,
I have azure function (net8.0 ) hosted in Linux and we want to query a table using XMLA like. Below is a sample code and getting error as Not found . Please note that I can't use Adomdconnection as it is not supported in Linux OS
string aasRegion = Environment.GetEnvironmentVariable("AAS_REGION");
string aasServerName = "xyz";
string databaseName = "abc";
string tenantId = Environment.GetEnvironmentVariable("TENANT_ID");
string clientId = Environment.GetEnvironmentVariable("CLIENT_ID");
string clientSecret = Environment.GetEnvironmentVariable("CLIENT_SECRET");
string serverUrl = $"https://{aasRegion}.asazure.windows.net/{aasServerName}
string endpointUrl = $"{serverUrl}/webapi/xmla";
string xmlaQuery = $@"
<Execute xmlns=""urn:schemas-microsoft-com:xml-analysis"">
<Command>
<Statement>
SELECTCOLUMNS (
FILTER (
student,
student[id] = 5
),
""name"", student[name]
)
</Statement>
</Command>
<Properties>
<PropertyList>
<Catalog>abc</Catalog>
<Format>Tabular</Format>
</PropertyList>
</Properties>
</Execute>";
var app = ConfidentialClientApplicationBuilder.Create(clientId)
.WithClientSecret(clientSecret)
.WithAuthority(new Uri($"https://login.microsoftonline.com/{tenantId}"))
.Build();
string[] scopes = new string[] { $"https://{aasRegion}.asazure.windows.net/.default" };
var authResult = await app.AcquireTokenForClient(scopes).ExecuteAsync();
string accessToken = authResult.AccessToken;
// Prepare and send the HTTP request
var request = new HttpRequestMessage(HttpMethod.Post, endpointUrl);
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);
request.Content = new StringContent(xmlaQuery);
request.Content.Headers.ContentType = new MediaTypeHeaderValue("application/xml");
var response = await httpClient.SendAsync(request);
var responseContent = await response.Content.ReadAsStringAsync();
An Azure service that provides an enterprise-grade analytics engine.
Can anyone please share a whole working example.
Thanks in advance.
Note: am getting URL not found error.
Hi Jagmohan Singh Salaria,
Welcome to the Microsoft Q&A.
Thanks for your question. Since you're hosting the Azure Function on Linux, you’re right that AdomdConnection won’t work—it’s Windows-only. A good workaround is to use XMLA over HTTP, which lets you query Azure Analysis Services from any platform.
Here’s how you can do it:
<Execute xmlns="urn:schemas-microsoft-com:xml-analysis">
<Command>
<Statement>
EVALUATE
SELECTCOLUMNS (
FILTER (
student,
student[id] = 5
),
"name", student[name]
)
</Statement>
</Command>
<Properties>
<PropertyList>
<Catalog>abc</Catalog>
<Format>Tabular</Format>
</PropertyList>
</Properties>
</Execute>
text/xml.https://<region>.asazure.windows.net/<server>/webapi/xmla).