1

In AZURE ANALYSIS SERVICES Tabular model (with compatibility level 1400) I imported a Blob storage account as a Data Source. It's Authentication Kind is Key kind of authentication. The key is a Static Key.

But while refreshing the Tabular using a Runbook in Automation Account (Cloud PowerShell) is there a way to pass the key/credentials so that it could authenticate?

Otherwise the PowerShell fails with below message

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.

Here is the Source definition copied from Model.bim file:

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

this is the code I ran in PowerShell to process the Database:

Invoke-ProcessASDatabase -databasename $DatabaseName -server $AnalysisServerName -RefreshType "Full" -Credential $SPCredential

1 Answers1

1

Okay I also hit a similar issue and found the solution, add "Key" to the "credential" object:

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

This isn't well documented by Microsoft, but this worked for me

Update with PowerShell sample:

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
}
Ollie F
  • 67
  • 3
  • 10
  • How do you add this to the runbook? I have the same issue. In the runbook we specify the credential something like $_Credential = Get-AutomationPSCredential -Name "ServicePrincipal" How do you enter that line in the runbook? – GIZNAJ Sep 22 '20 at 20:17
  • 1
    @GIZNAJ see above I've added a sample piece of PowerShell of how I add in the "Key" property – Ollie F Sep 23 '20 at 21:18
  • 1
    I have an update too. The task/extension that was deploying AAS to azure didn't have the XMLA and thus the deployment was bad. When running the "Process" command, it would fail because of that reason. Now that the XMLA values are there in the deployment, we no longer get the error raised in this thread. I have added the key though like you have suggested so it is a win win for us. – GIZNAJ Sep 24 '20 at 17:37