Search code examples
azure.net-coreazure-analysis-services

what is the correct way to format a connection string for azure analysis services using Microsoft.AnalysisServices.NetCore


Creating a function app to refresh a data model in azure analysis services based on a timer trigger. Using Microsoft.AnalysisServices.NetCore package.

What is the correct way to format the connection string? have i done this correctly?

// analysis services details
string serverName = "myserver";
string databaseName = "mydb";
string userId = "userId";
string password = Environment.GetEnvironmentVariable("PWD");

//connection string
var connectionString = $"Provider=MSOLAP;Data Source=asazure://uksouth.asazure.windows.net/{serverName};Initial Catalog={databaseName};User ID={userId};Password={password};Persist Security Info=True;Impersonation Level=Impersonate";

Solution

    • The way which you have set the Connection String is correct but the Data Source has to be only the server name.

    enter image description here

    It has to be

    var connectionString = $"Provider=MSOLAP;Data Source={serverName};Initial Catalog={databaseName};User ID={userId};Password={password};Persist Security Info=True;Impersonation Level=Impersonate;";
    

    Refer blogs by Sanjay Bhagia and James Broome even it explains the same.

    I have tried to connect it from my Application.

    enter image description here

    • You can add AdomdConnection using Microsoft.AnalysisServices.AdomdClient;

    My .csproj file:

    <PackageReference Include="Unofficial.Microsoft.AnalysisServices.AdomdClientNetCore" Version="15.3.1.2" />
    
    • Make sure to add the user in the Security section.