Process AAS Model Using PowerShell: We will see how to process the model using windows PowerShell scripts, in our last article we have seen how to automate the model refresh using azure automation account, for more information click here!
Process AAS Model Using PowerShell (Azure/Windows)
The article will give your idea on how to do refresh using PowerShell script and most importantly what are modules required to process any Azure Analysis Model. Process AAS Model Using PowerShell is common problem and people most likely will use different scripts to do it.
Step 1: Open PowerShell using administrator rights. If you don’t want to use Windows PowerShell, then you can go with PowerShell 7, click here to install! Note: In my case the required drivers are already installed so it will show me that the module already exists.
Install-Module -Name Az -AllowClobber -Scope CurrentUser
Step 2: Make sure that the PowerShell scripts can be run remotely on your computer using below command. This step is not mandatory but, in few scenarios, I have seen the issue where we can face problem because of GP.
Set-ExecutionPolicy remotesigned
Step 3: Install this SQL module to do the process. This module is mandatory because the Analysis Services uses feature/dependencies of SQL server modules.
Install-module SqlServer -Force -Allowclobber
Step 4: Now we will connect to our azure account to get the details of AAS and then in the next command we will process the model in one go.
Connect-AzAccount
The code will appear in the PowerShell, copy the URL and browse and then give the code which is present in the output.
One authenticated, you will see your subscription details, make sure you have admin rights on AAS.
Step 5: Script to invoke full process. This below command you have to make some changes in order to process your tabular model. Note: This below PowerShell command is one line command so when you copy, please make sure it is not in next line.
If you want to automate the process using azure automate, then you can follow this document: https://kingfishertechtips.in/azure-automation-runbook-aas-model-refresh/
- Below command if you are using UPN/Microsoft Entra Account to refresh model.
Invoke-ProcessASDatabase -Server "asazure://westeurope.asazure.windows.net/abhisheksinha:rw" -DatabaseName "synaps_sql_to_aas" -RefreshType "Full"
- Command to invoke command if you are using Service Principals.
Invoke-ProcessASDatabase -Server "asazure://westeurope.asazure.windows.net/abhisheksinha:rw" -DatabaseName "AzureSQLTabulerModel" -RefreshType "Full" -Credential $Credential -ServicePrincipals
Other TSG Posts: TSG Archives » Kingfisher Tech Tips