繁体   English   中英

用于Azure SSAS多维数据集更新的Rest API

[英]Rest API for Azure SSAS cube refreshment

我目前正在尝试创建Rest API来刷新Azure中的SSAS多维数据集。 我遵循了此链接中的所有步骤。 然后,我使用该代码刷新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}"); 
}

通常,一切都应该没问题,但这是我的错误消息:

无法从程序集'mscorlib,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = *****加载类型'System.Security.Principal.WindowsImpersonationContext'

有解决的办法吗?

非常感谢。

好像您缺少对nuget包System.Security.Principal的引用

#r "System.Security.Principal"

请注意,存在适用于Azure Analysis Services的REST API。

您可以在这里找到它https://docs.microsoft.com/en-us/azure/analysis-services/analysis-services-async-refresh

只是使用它

  1. 创建Azure AD服务主体(应用程序)
  2. 将其作为管理员添加到服务器
  3. 获取资源https://*.asazure.windows.net的此服务主体的令牌
  4. 发送POST请求至

    https://首次展示 .asazure.windows.net / servers / serverName / models / resource / refresh

与身体

{
  "Type": "Full",
  "CommitMode": "transactional",
  "MaxParallelism": 2,
  "RetryCount": 2,
  "Objects": [
    {
        "table": "DimCustomer",
        "partition": "DimCustomer"
    },
    {
        "table": "DimDate"
    }
  ]
}

有关详细说明,请检查

https://marczak.io/posts/2019/06/logic-apps-refresh-analysis-services/

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM