【问题标题】:How deploy a cube (XMLA format) on an Azure SSAS如何在 Azure SSAS 上部署多维数据集(XMLA 格式)
【发布时间】:2021-04-13 04:13:39
【问题描述】:

大家下午好,

首先祝你在 2021 年乃至 2022 年一切顺利 这是我的问题,我正在等待我们的技术团队授予我访问 Azure Devops 平台的权限(这可能需要一段时间),但同时我想要一个临时解决方案,允许我部署 xmla(Json 格式)直接在现有的 SSAS 实例上,以便使用 powershell 创建多维数据集。

我已经阅读了一些文档,似乎最好的解决方案是使用 Invoke-ASCmd(如果我错了,请纠正我);而且我认为不可能通过 REST API 做到这一点

想法是以自动化的方式创建一个新的多维数据集

这是我的代码

$myfile = "c:\temp\test2.xmla"
$mybody=Get-Content -Path c:\temp\test2.xmla
$myaas="asazure://northeurope.asazure.windows.net/pocenvironment"
$myaasname="pocenvironment"
$mytenant = "1234"
$myclientID = "ABCD";
$mykeyID = "theKeyID";
$myauthority = "https://login.windows.net/" + $mytenant + "/oauth2/authorize";

$TokenRequestParams = @{
    Method = 'POST'
    Uri    = "$myauthority"
    Body   = @{
        grant_type = "urn:ietf:params:oauth:grant-type:device_code"
        code       = $DeviceCodeRequest.device_code
        client_id  = $myclientID
    }
}
$TokenRequest = Invoke-RestMethod @TokenRequestParams

$myconnectstr="Provider=MSOLAP;User ID=;Password="+$TokenRequest+";Data Source="+$myaas+";Persist Security Info=True;Impersonation Level=Impersonate"

Invoke-ASCmd -InputFile $myfile -ConnectionString $myconnectstr -Server $myaas

XMLA 是这样的

{
  "create": {
    "database": {
      "name": "TESTME",
      "compatibilityLevel": 1500,
      "model": {
        "culture": "en-GB",
        "dataSources": [
          
        ],
        "tables": [
           
        ],
        "relationships": [
          
        ],
        "roles": [
          {
            "name": "Admin",
            "modelPermission": "administrator",
            "members": [
              {
                "memberName": "myemail@domain.com",
                "identityProvider": "AzureAD"
              }
                     ]
          },
          {
            "name": "Reader",
            "modelPermission": "read",
            "members": [
              
            ]
          }
        ],
        "annotations": [
          {
            "name": "ClientCompatibilityLevel",
            "value": "400"
          }
        ]
      }
    }
  }
}

但我收到以下错误消息(尝试使用 powershell ise x86 和 64 位)

<b>Invoke-ASCmd : Object reference not set to an instance of an object.
At line:24 char:1
+ Invoke-ASCmd -InputFile $myfile -ConnectionString $myconnectstr -Serv ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Invoke-ASCmd], NullReferenceE 
   xception
    + FullyQualifiedErrorId : System.NullReferenceException,Microsoft.Analysis 
   Services.PowerShell.Cmdlets.ExecuteScriptCommand
</b>

【问题讨论】:

    标签: azure powershell automation ssas


    【解决方案1】:

    我一直在尝试在 Azure AAS 表格模型上“创建替换”多个表,在我的情况下 $connectionstring 是一个问题,如果您还没有尝试过,请先尝试使用您的 id 进行身份验证。谢谢

    【讨论】:

    • 如果我添加我的 uid/pwd,我会收到相同的错误消息。您是否能够找到解决方案?您使用了哪个连接字符串? Invoke-ASCmd : 对象引用未设置为对象的实例。
    • 先决条件:Install-Module -Name Az.AnalysisServices Connect-AzAccount Set-AzContext -Subscription "xxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" Invoke-ASCmd -Server:asazure://xxregionxx .asazure.windows.net/xxservernamexx -Database:xxDbNamexx -InputFile:"C:\temp\temp.xmla" --此步骤应提示对第一步中使用的 AzAccount 进行身份验证在我的情况下,服务主体有 2 个问题没有 AAS 服务器的权限,然后令牌连接不正确,无法形成连接字符串,上述步骤帮助我验证脚本是否正常工作
    • link,这是一个很好的例子
    • 感谢您的链接,已经在我的收藏夹中(一旦我们的 Azure Devops 准备就绪 ^^)同时我已经按照您的建议,除了 Invoke-ASCmd 之外一切都很好。 Invoke-ASCmd :对象引用未设置为对象的实例。我什至尝试添加我的连接字符串(如我的问题顶部所述),但没有成功。您是否成功实施了解决方案?
    【解决方案2】:

    找到解决方案并修复 事实上,powershell 模块 sqlserver 在版本 20 中无法正常运行,但版本 21 允许选择 -tenantid。

    没有更多错误,部署运行顺利:)

    感谢您的帮助:)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-03-04
      • 2018-03-17
      • 2013-12-09
      • 2023-03-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多