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

XMLA/TMSL from .Net Core


As the rest of the Azure world migrates to .Net Core it seems Azure Analysis Services is stuck on the .Net Framework.

Is there a way to execute TMSL or XMLA against a SSAS Cube using frameworks available on .Net Core?

This means AMO clients and Tabular Object Model etc. are excluded as these assemblies only exists for .Net Framework.

I'm trying to update a cube data source connection from an Azure Function V2.


Solution

  • This is a .net core console example executing XMLA, I am sure it works.

    using Microsoft.AnalysisServices;
    using System;
    
    namespace ConsoleApp1
    {
        class Program
        {
            static void Main(string[] args)
            {
                Console.WriteLine("Hello World!");
                Server OlapServer = new Server();
                string connStrOlap = "Provider=MSOLAP.4; Data     Source=http://localhost/olap/msmdpump.dll; Catalog=YourCatalog;";
                OlapServer.Connect(connStrOlap);
                string XMLACommand = @"
    
    <Batch xmlns=""http://schemas.microsoft.com/analysisservices/2003/engine"">
        <Parallel>
            .......Your XML content.......
        </Parallel>
    </Batch>
         
                    ";
            
                var result = OlapServer.Execute(XMLACommand);
                OlapServer.Disconnect();
                OlapServer.Dispose();
                Console.ReadKey();
            }
        }
    }
    

    be sure to install nuget package:(now they are preview version) Microsoft.AnalysisServices.NetCore.retail.amd64 Microsoft.AnalysisServices.AdomdClient.NetCore.retail.amd64