如何在 Azure SSAS 上部署多维数据集(XMLA 格式)
How deploy a cube (XMLA format) on an Azure SSAS
大家下午好,
首先祝你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 AAS 表格模型上尝试类似于“createoreplace”多个表的方法,在我的情况下 $connectionstring 是一个问题,如果您还没有尝试过,请先尝试使用您的 ID 进行身份验证。谢谢
已找到解决方案并修复
事实上,powershell 模块 sqlserver 不能 运行 正确地使用版本 20,但是版本 21 允许 select -tenantid。
不再出错,部署运行顺利:)
感谢您的帮助:)
大家下午好,
首先祝你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 AAS 表格模型上尝试类似于“createoreplace”多个表的方法,在我的情况下 $connectionstring 是一个问题,如果您还没有尝试过,请先尝试使用您的 ID 进行身份验证。谢谢
已找到解决方案并修复 事实上,powershell 模块 sqlserver 不能 运行 正确地使用版本 20,但是版本 21 允许 select -tenantid。
不再出错,部署运行顺利:)
感谢您的帮助:)