【问题标题】:Authenticate Azure Blob Storage Account in cloud using a runbook使用 Runbook 在云中对 Azure Blob 存储帐户进行身份验证
【发布时间】:2019-08-08 07:56:55
【问题描述】:

AZURE ANALYSIS SERVICES 表格模型(兼容级别为 1400)中,我将 Blob 存储帐户作为数据源导入。它的 Authentication KindKey 类型的身份验证。密钥是静态密钥。

但是,在使用自动化帐户 (Cloud 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 文件中复制的 Source 定义:

 {
  "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

【问题讨论】:

    标签: azure-powershell azure-analysis-services xmla


    【解决方案1】:

    好的,我也遇到了类似的问题并找到了解决方案,将“Key”添加到“credential”对象:

    "credential": {
        "AuthenticationKind": "Key",
        "kind": "AzureBlobs",
        "path": "https://storage.blob.core.windows.net/",
        "PrivacySetting": "Organizational",
        "Key": "<StorageAccountKey>"
      }
    

    微软没有很好地记录这一点,但这对我有用

    使用 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
    }
    

    【讨论】:

    • 如何将此添加到运行手册中?我有同样的问题。在 Runbook 中,我们指定了类似于 $_Credential = Get-AutomationPSCredential -Name "ServicePrincipal" 的凭据。如何在 Runbook 中输入该行?
    • 我也有更新。将 AAS 部署到 azure 的任务/扩展没有 XMLA,因此部署很糟糕。当运行“进程”命令时,它会因为这个原因而失败。既然 XMLA 值已经存在于部署中,我们将不再收到此线程中引发的错误。我已经按照您的建议添加了密钥,所以这对我们来说是双赢的。
    猜你喜欢
    • 2019-05-23
    • 2021-02-08
    • 2019-12-17
    • 2021-11-30
    • 1970-01-01
    • 1970-01-01
    • 2016-06-04
    • 1970-01-01
    • 2020-11-09
    相关资源
    最近更新 更多