This small manual should help data engineers refresh Azure Analysis Services from Azure Data Factory in just few minutes.
This code will refresh Azure Analysis Services model and wait for it's completion using Azure Data Factory Webhook activity to call Azure Logic App.
- Azure Data Factory
- Azure Analysis Services
- Permissions in Azure to
- Deploy ARM templates, and
- Admin rights Azure Analysis Services
- At least one model deployed in AAS
- Azure Logic Apps are extremely cheap small asynchronous tasks. There is literally 0$ costs involved in just waiting as consumption based (serverless) Logic Apps have no infrasurcture associated with them.
- No Data Factory cost associated for waiting when using Webhook!
- Create Logic App from ARM template
- Assign Logic App Managed Identity to Azure Analysis Services as an administrator
- Get Logic App URL
- Add & configure Webhook Activity in Data Factory
-
Create Logic App from ARM template
New-AzResourceGroupDeployment ` -ResourceGroupName <your_logic_app_resource_group_name> ` -LogicAppName <your_logic_app_name> ` -TemplateUri "https://raw.githubusercontent.com/MarczakIO/azure-enterprise-templates/main/data-factory/refresh-analysis-services-logic-app/template.json"
-
Assign Logic App Managed Identity to Azure Analysis Services as an administrator
Invoke-WebRequest ` -Uri "https://raw.githubusercontent.com/MarczakIO/azure-enterprise-templates/main/data-factory/refresh-analysis-services-logic-app/assign-resource-identity-as-aas-admin.ps1" ` -OutFile assign-resource-identity-as-aas-admin.ps1 .\assign-resource-identity-as-aas-admin.ps1 ` -resourceName <your_logic_app_name> ` -resourceType "Microsoft.Logic/workflows" ` -resourceResourceGroupName <your_logic_app_resource_group_name> ` -resourceSubscriptionName <your_logic_app_subscription_name> ` -analysisServicesName <your_analysis_services_name> ` -analysisServicesResourceGroupName <your_analysis_services_resource_group_name> ` -analysisServicesSubscriptionName <your_analysis_services_subscription_name>
-
Get Logic App URL
Get-AzLogicAppTriggerCallbackUrl ` -Name <your_logic_app_name> ` -ResourceGroupName <your_logic_app_resource_group_name> ` -TriggerName manual
-
Add & configure Webhook Activity in Data Factory (described below)
-
Create Logic App from ARM template
-
Option 1 - Deploy with ARM template using Azure Portal
-
Option 2 - Using ARM template manually
-
-
Assign Logic App Managed Identity to Azure Analysis Services as an administrator
-
Option #1 - Use PowerShell manually script located here assign-resource-identity-as-aas-admin.ps1
- Replace six variables with the ones from your environment
- resourceName
- resourceResourceGroupName
- resourceType
- resourceSubscriptionName
- analysisServicesName
- analysisServicesResourceGroupName
- analysisServicesSubscriptionName
- Replace six variables with the ones from your environment
-
Option #2 - Use SQL Server Management Studio (TO-DO)
-
Add & configure Webhook Activity in Data Factory
-
Open Azure Data Factory and add new Webhook Activity
Configure the setup as follows
-
URL - Get URL from Logic App first step.
-
Method POST
-
Body - use this template
{ "AAS Model Name": "<model_name>", "AAS Refresh Body": { "CommitMode": "transactional", "MaxParallelism": 2, "Objects": [], "RetryCount": 2, "Type": "Full" }, "AAS Rollout Region": "<rollout_region>", "AAS Server Name": "<server_name>", "Wait For Sync": <true/false> }
Example
{ "AAS Model Name": "DemoTabular", "AAS Refresh Body": { "CommitMode": "transactional", "MaxParallelism": 2, "Objects": [], "RetryCount": 2, "Type": "Full" }, "AAS Rollout Region": "westeurope", "AAS Server Name": "analysisservicesdemo", "Wait For Sync": true }
-
Report status on callback - Checked Important! - This is important to be checked.
-
Timeout - Set up maximum time that you expect to refresh to finish in.
- Debug and test it!