簡體   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