在AZURE ANALYSIS SERVICES表格模型(兼容级别为 1400(中,我导入了一个 Blob 存储帐户作为数据源。它的身份验证类型是密钥类型的身份验证。密钥是静态密钥。
但是,在使用自动化帐户 (云 PowerShell( 中的 Runbook 刷新表格时,是否有办法传递密钥/凭据,以便它可以进行身份验证?
否则,PowerShell 将失败并显示以下消息
The given credential is missing a required property. Data source kind: AzureBlobs. Authentication kind: Key. Property name: Key. The exception was raised by the IDbConnection interface.
下面是从 Model.bim 文件复制的源定义:
{
"createOrReplace": {
"object": {
"database": "azureanalysisservicesdatabase",
"dataSource": "OMSLogs"
},
"dataSource": {
"type": "structured",
"name": "OMSLogs",
"connectionDetails": {
"protocol": "azure-blobs",
"address": {
"account": "storage",
"domain": "blob.core.windows.net"
},
"authentication": null,
"query": null
},
"credential": {
"AuthenticationKind": "Key",
"kind": "AzureBlobs",
"path": "https://storage.blob.core.windows.net/",
"PrivacySetting": "Organizational"
}
}
}
}
这是我在PowerShell中运行用于处理数据库的代码:
Invoke-ProcessASDatabase -databasename $DatabaseName -server $AnalysisServerName -RefreshType "Full" -Credential $SPCredential
好的,我也遇到了类似的问题并找到了解决方案,将"密钥"添加到"凭据"对象:
"credential": {
"AuthenticationKind": "Key",
"kind": "AzureBlobs",
"path": "https://storage.blob.core.windows.net/",
"PrivacySetting": "Organizational",
"Key": "<StorageAccountKey>"
}
Microsoft没有很好地记录这一点,但这对我有用
使用PowerShell示例进行更新:
Get-ChildItem -Filter "drop" -Recurse -Path $sourcePath -Directory |
Get-ChildItem -recurse -filter *.asdatabase -file | ForEach-Object {
$filename = $_.fullname
$generatedFile = $buildPath + $_.BaseName + ".xmla"
"Processing $filename"
& $deploymentWizard $filename /o:$generatedFile
# Have to add Blob Key now, as Deployment Wizard doesn't like
# adding the Key (bug maybe? Or DeloyWizard isn't up to date)
$file = Get-Content $generatedFile -Raw | ConvertFrom-Json
$file.createOrReplace.database.model.dataSources | ForEach-Object {
# Add Blob Key to credential object
if ($_.name.StartsWith("AzureBlobs/")) {
$_.credential | Add-Member -Name "Key" -Value $storageKey -MemberType NoteProperty -Force
}
}
$file = $file | ConvertTo-Json -Depth 32
$file | Set-Content -Path $generatedFile -Encoding utf8
}