Search code examples
powershellazureautomationazure-analysis-services

Azure Analysis Services Processing through Azure Automation


I'm trying to get my AAS models processed automatically using Azure Automation Runbooks. Our tenant uses multi-factor authentication so doing it with AD users is not an option, so I'm trying to make it work through a Service Principal (AzureRunAsConnection specifically).

  1. I created the service principal.
  2. Granted permissions to the server and to the model via SSMS (adding it to the roles at server level and model level)
  3. Created the script to use the AzureRunAsConnection and the Invoke-ProcessTable

I've gone through all this post basically, Use Automation RunAs service principal to connect to Azure Analysis Services and process

But I still can't get the script works using the AzureRunAsConnection, the message I still get is

Invoke-ProcessTable : The "XXXX" database does not exist on the server.

The question in the link solves it by granting permissions via SSMS, but I already did that and still getting the same problem.

Any help is appreaciated


Solution

  • I got a solution to this problem from the MSDN forums, Eamon O Reilly suggested me to add the Service Principal to the AAS admins via this command:

    $SPAdmin = "app:c9ab3d0cf43-38b9-4d52-ba97-001ddaede361b@72fCCFbf-86f1-41af-9aab-25fd7cd011aac47"
    
     Set-AzureRmAnalysisServicesServer -Name <analysisserver> -ResourceGroupName <resourcegroupname> -Administrator $SPAdmin 
    

    What I didn't know was that the AzureRunAs connection of the Runbook has a different application id than the actual service principal, so once I added the AzureRunAs application id as an AAS admin, the runbook worked.