大家下午好,
首先,我希望你在2021年乃至2022年一切顺利,这是我的问题,我正在等待我们的技术团队授予我访问Azure Devops平台的权限(这可能需要一段时间),但同时我希望有一个临时解决方案,允许我直接在现有的SSAS实例上部署xmla (Json格式),以便使用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 $myaasXMLA是这样的
{
"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>发布于 2021-01-11 22:17:43
解决方案找到并修复实际上powershell模块sqlserver不能在版本20中正确运行,但版本21允许选择-tenantid。
没有更多的错误,部署运行顺利:)
感谢您的帮助:)
发布于 2021-01-07 20:56:11
我一直在尝试类似于在Azure AAS表格模型上"createoreplace“多个表的方法,在我的例子中,$connectionstring是一个问题,如果你还没有尝试,请尝试首先使用你的id进行身份验证。谢谢
https://stackoverflow.com/questions/65612316
复制相似问题