Automating Azure Analysis Services processing with Azure Functions / Microsoft Analysis Services Tabular Namespace

Provides an object API used to administer Analysis Services tabular server instances, databases, roles and assemblies. This namespace targets tabular databases at compatibility level 1200 or higher, where objects are described in tabular metadata as tables, columns, and relationships.

Below is the C# .net console application example to process a single table within Azure Analysis services tabular model

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Configuration;
using Microsoft.AnalysisServices.Tabular;
namespace DHG_Process_AAS_Cubes
{
class Program
{
static void Main(string[] args)
{
try {
Microsoft.AnalysisServices.Tabular.Server asSrv = new Microsoft.AnalysisServices.Tabular.Server();
var connStr = ConfigurationManager.ConnectionStrings["AzureASConnString"].ConnectionString; asSrv.Connect(connStr);
Database db = asSrv.Databases["database name"];
Model m = db.Model;
//db.Model.RequestRefresh(RefreshType.Full);
// Mark the model for refresh
//m.RequestRefresh(RefreshType.Full);
// Mark the model for refresh
m.Tables["table name"].RequestRefresh(RefreshType.Full);
// Mark only one table for refresh
db.Model.SaveChanges();
//commit which will execute the refresh
asSrv.Disconnect();
}
catch (Exception e)
{
Console.WriteLine("error"); } } }
}
%d bloggers like this: