Refresh with Logic Apps
By using Logic Apps and REST calls, you can perform automated data refresh operations on your Azure Analysis tabular models, including synchronization of read-only replicas for query scale-out.
To learn more about using REST APIs with Azure Analysis Services, see Asynchronous refresh with the REST API.
All calls must be authenticated with a valid Azure Active Directory (OAuth 2) token. The examples in this article will use a Service Principal (SPN) to authenticate to Azure Analysis Services. To learn more, see Create a service principal by using Azure portal.
Design the logic app
The following examples assume that the Azure Analysis Services firewall is disabled. If the firewall is enabled, the public IP address of the request initiator must be added to the approved list in the Azure Analysis Services firewall. To learn more about Azure Logic Apps IP ranges per region, see Limits and configuration information for Azure Logic Apps.
Create a Service Principal (SPN)
To learn about creating a Service Principal, see Create a service principal by using Azure portal.
Configure permissions in Azure Analysis Services
The Service Principal you create must have server administrator permissions on the server. To learn more, see Add a service principal to the server administrator role.
Configure the Logic App
In this example, the Logic App is designed to trigger when a HTTP request is received. This will enable the use of an orchestration tool, such as Azure Data Factory, to trigger the Azure Analysis Services model refresh.
Once you have created a Logic App:
In the Logic App designer, choose the first action as When a HTTP request is received.
This step will populate with the HTTP POST URL once the Logic App is saved.
Add a new step and search for HTTP.
Select HTTP to add this action.
Configure the HTTP activity as follows:
|URI||https://your server region/servers/aas server name/models/your database name/refreshes
For example: https://westus.asazure.windows.net/servers/myserver/models/AdventureWorks/refreshes
|Body||To learn more about forming the request body, see Asynchronous refresh with the REST API - POST /refreshes.|
|Authentication||Active Directory OAuth|
|Tenant||Fill in your Azure Active Directory TenantId|
|Client ID||Enter your Service Principal Name ClientID|
|Secret||Enter your Service Principal Name Secret|
Now test the Logic App. In the Logic App designer, click Run.
Consume the Logic App with Azure Data Factory
Once the Logic App is saved, review the When a HTTP request is received activity and then copy the HTTP POST URL that is now generated. This is the URL that can be used by Azure Data Factory to make the asynchronous call to trigger the Logic App.
Here's an example Azure Data Factory Web Activity that does this action.
Use a self-contained Logic App
If you don't plan on using an Orchestration tool such as Data Factory to trigger the model refresh, you can set the logic app to trigger the refresh based on a schedule.
Using the example above, delete the first activity and replace it with a Schedule activity.
This example will use Recurrence.
Once the activity has been added, configure the Interval and Frequency, then add a new parameter and choose At these hours.
Select the wanted hours.
Save the Logic App.