大家下午好
首先祝您 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": "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c3aebaa6aea2aaaf83a7acaea2aaadeda0acae" rel="noreferrer noopener nofollow">[email protected]</a>",
"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 AAS 表格模型上“createoreplace”多个表的操作,在我的例子中 $connectionstring 是一个问题,如果您还没有尝试过,请先尝试使用您的 id 进行身份验证..谢谢
关于azure - 如何在 Azure SSAS 上部署多维数据集(XMLA 格式),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65612316/