首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在Azure SSAS上部署多维数据集(XMLA格式)

如何在Azure SSAS上部署多维数据集(XMLA格式)
EN

Stack Overflow用户
提问于 2021-01-07 20:22:38
回答 2查看 76关注 0票数 1

大家下午好,

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

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

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

以下是我的代码

代码语言:javascript
复制
$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是这样的

代码语言:javascript
复制
{
  "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位)

代码语言:javascript
复制
<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>
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2021-01-11 22:17:43

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

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

感谢您的帮助:)

票数 1
EN

Stack Overflow用户

发布于 2021-01-07 20:56:11

我一直在尝试类似于在Azure AAS表格模型上"createoreplace“多个表的方法,在我的例子中,$connectionstring是一个问题,如果你还没有尝试,请尝试首先使用你的id进行身份验证。谢谢

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65612316

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档