I'm currently trying to create a Rest API to refresh a SSAS cube in Azure. I followed all the steps from this link . Then I'm using that code to refresh the Cube1 :
#r "Microsoft.AnalysisServices.Tabular.DLL"
#r "Microsoft.AnalysisServices.Core.DLL"
#r "System.Configuration"
using System;
using System.Security;
using System.Security.Principal;
using System.Configuration;
using Microsoft.AnalysisServices.Tabular;
public static void Run(TimerInfo myTimer, TraceWriter log)
{
log.Info($"C# Timer trigger function started at: DateTime.Now}");
// try
// {
Microsoft.AnalysisServices.Tabular.Server asSrv = new Microsoft.AnalysisServices.Tabular.Server();
log.Info("Log1");
var connStr = "Provider=MSOLAP;Data Source=asazure://serveraddress; Initial Catalog=Cube1;User ID=*****;Password=*****";
log.Info("Log2");
asSrv.Connect(connStr);
log.Info("Log3");
Database db = asSrv.Databases["Cube1"];
log.Info("Log4");
Model m = db.Model;
m.RequestRefresh(RefreshType.Full); // Mark the model for refresh
db.Model.SaveChanges(); //commit which will execute the refresh
asSrv.Disconnect();
// }
// catch (Exception e)
// {
// log.Info($"C# Timer trigger function exception: {e.ToString()}");
// }
log.Info($"C# Timer trigger function finished at: {DateTime.Now}");
}
Normally everything should be ok but here is my error message :
Could not load type 'System.Security.Principal.WindowsImpersonationContext' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=*****
Any idea to solve this ?
Thanks a lot.
好像您缺少对nuget包System.Security.Principal的引用
#r "System.Security.Principal"
Please note that there is REST API available for Azure Analysis Services.
You can find it here https://docs.microsoft.com/en-us/azure/analysis-services/analysis-services-async-refresh
To use it just
Send POST request to
https:// rollout .asazure.windows.net/servers/ serverName /models/ resource /refresh
with body
{
"Type": "Full",
"CommitMode": "transactional",
"MaxParallelism": 2,
"RetryCount": 2,
"Objects": [
{
"table": "DimCustomer",
"partition": "DimCustomer"
},
{
"table": "DimDate"
}
]
}
For detailed description check
https://marczak.io/posts/2019/06/logic-apps-refresh-analysis-services/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.