Register Service Principal To Automated Job Process In AAS

Register Service Principal: Azure Analysis Services presents opportunities for the automation of administrative tasks including server provisioning, scale up/down, pause/resume, model management, data refresh, deployment, among others. This can leverage cloud efficiencies and helps ensure the repeatability and reliability of mission-critical systems.

Such tasks can be performed in the Azure cloud using PowerShell in unattended mode. Services such as Azure Automation exist to support these processes. They should be executed using service principals for enhanced security and ease of management. Service principals are similar to on-premises service accounts, but for Azure. They use credentials in the form of an application ID along with a password or certificate. Model permissions are assigned to service principals through role membership like normal Azure Active Directory UPN accounts.

Prerequisite

Install-Module -Name SqlServer -Force
Install-Module -Name Azure.AnalysisServices -Force

Please install the sql server libraries whether it is on your local machine/azure PowerShell https://www.powershellgallery.com/packages/SqlServer

Here is a detail step by step instruction to set it up How to Automate Processing your Azure Analysis Services Models 

Service Principal

Register Service Principal support is being added to the code now, Connection string will look like this User:app:[appid];Password:cert:[thumbprint]

Instructions:

  1. Tenant ID can be found by clicking on the Help/question mark button, click Show diagnostics
Register Service Principal
  • A .json file download will Popup. In this file you can find the tenant ID
Register Service Principal
  1. In the Azure Portal, open Azure Activity Directory, then choose App Registrations, click on New application registration
Automated Job Process In AAS
  1. Provide an application name and some URL to Register Service Principal
Automated Job Process In AAS
  • After you created this new application, you need to write down the application ID. This is the appId in the sample code
Automated Job Process In AAS
  1. Now you need to generate a key for this app ID. Click on Keys, type in the name of the key, such as appKey, then choose when it will expire, then click Save and this will Register Service Principal.
Register Service Principal
  1. After you save the key, the string value is displayed. You need to copy the key and save it at a safe place, because this is the only time the key will be displayed. They key will be masked if you leave this page and come back.
Register Service Principal

6. You need to come up with the username for the service principal as “app:”+application ID+”@” +tenant ID
For example, app:4cf98e73-8888-8888-b670-d21214d833ce@72f988bf-86f1-8888-8888-2d7cd011db47

7. In SSMS, you need to add this username in the database role so it has full control on the database for Register Service Principal.

In SSMS, you need to add this user name in the database role so it has full control on the database

Power Shell

First you need to install the Power Shell components using the following 2 commands to do Automated Job Process In AAS

Install-Module -Name SqlServer -Force
Install-Module -Name Azure.AnalysisServices -Force

Below is a test script that you can run locally in Power Shell

PowerShell script in Azure Automation

If you want to test locally you need the following modules to be installed

Install-Module -Name SqlServer -Force
Install-Module -Name Azure.AnalysisServices -Force

When you move to Azure Automation you need to import these modules from the gallery

#Import-Module AzureRM.AnalysisServices
#Import-Module Azure.AnalysisServices
#Import-Module SqlServer
 
$AASAppId = "b3725d14-8761-47a6-8067-abcd"
$AASAppKey = "Ct8AQAm2ro3z+tONkY+J0Cabcd="
$TenantId = "72f988bf-86f1-41af-91ab-abcd"
 

$AASServerName = "asazure://southcentralus.asazure.windows.net/abcd" 
$AASDatabaseName = "SharePointOnlineStan" 
 
$PWord = ConvertTo-SecureString -String $AASAppKey -AsPlainText -Force
$Credential = New-Object -TypeName "System.Management.Automation.PSCredential" -ArgumentList $AASAppId , $PWord
 
$rolloutEnvironment = $AASServerName.Replace("asazure://", "").Split("/")[0]
Write-Output $Credential
Write-Output $rolloutEnvironment
 
 
#Login-AzureAsAccount
Add-AzureAnalysisServicesAccount -Credential $Credential -ServicePrincipal -TenantId $tenantId -RolloutEnvironment  $rolloutEnvironment
 
#Invoke-ASCmd -Server $AASServerName -Database $AASDatabaseName -Query $updateDataSource
Invoke-ProcessASDatabase -Server $AASServerName -DatabaseName $AASDatabaseName -RefreshType "Full"
Write-Output "Finished!"

#Invoke-ASCmd -Server $AASServerName -Database $AASDatabaseName -Query $updateDataSource
Invoke-ProcessASDatabase -Server $AASServerName -DatabaseName $AASDatabaseName -RefreshType "Full"
Write-Output "Finished!"

Then you can place the script in Azure Automation to Automated Job Process In AAS https://azure.microsoft.com/en-us/documentation/learning-paths/automation

AAS MODEL REFRESH

TSG’s

  1. Postman: AAS Model Refresh Using REST API
  2. RDCMan Scaling Is Blurry: Fix In 3 Steps (kingfishertechtips.in)
  3. Port Number For Analysis Services – Find Ports For SSAS? (kingfishertechtips.in)
  4. SMTP Server In SSRS/PBIRS |Subscribe To Email Problem/Issue (kingfishertechtips.in)
  5. SQL Server 2022 Download, Install, Connect Using SSMS Tool (kingfishertechtips.in)
  6. Creating Tabular Project & Deploy Model To Analysis Service (kingfishertechtips.in)
  7. Deploy Tabular Project To Azure Analysis Service – SSDT Tool (kingfishertechtips.in)
  8. SSRS/PBIRS – Install And Configure The Report Server On-Prem (kingfishertechtips.in)
  9. Could Not Load Folder Contents In Portal URLs – SSRSPBIRS (kingfishertechtips.in)
  10. SSRS/PBIRS – Install And Configure The Report Server On-Prem (kingfishertechtips.in)
  11. SQL Server 2022 Download, Install, Connect Using SSMS Tool (kingfishertechtips.in)
  12. Capture Fiddler Trace for Debugging the Network Traffic (kingfishertechtips.in)
  13. On-Premises Gateway: Configure/Map SQL DB To Power Bi (kingfishertechtips.in)
  14. Fixed Column/Row Header Make Visible In Any Report (kingfishertechtips.in)
  15. Self-Signed Certificate: Configure SSRS/PBIRS With SSL (kingfishertechtips.in)
  16. Create Local User Account/Local Admin User In Windows 10/11 (kingfishertechtips.in)
  17. Login With AAD/Domain/Microsoft Account To Azure VM’s/RDP (kingfishertechtips.in)
Vickey Rajpoot
Vickey Rajpoot

Hello there! I'm dedicated Microsoft Data & AI Engineer at LTIMindtree, where I thrive technology into actionable insights. Dive into my world by visiting my YouTube channel & Webiste, "Kingfisher Tech Tips".

Articles: 107

One comment

  1. Cтудия цветов собирает под заказ цветы в коробках с доставкой от 30 мин в с Одинцово и области
    Авторские букеты с доставкой: [url=https://dostavka-cvetov-odincovo.ru/]тут[/url]

Leave a Reply

Your email address will not be published. Required fields are marked *