(+351) 21 24 10006  ·  info@bconcepts.pt
Carnaxide, Lisbon

How to automate Power BI Refresh in Fabric: step by step

João Barros 14 de September de 2026 4 min read

This tutorial shows how to automate the refresh of Power BI reports in Microsoft Fabric using Pipelines and the REST API to schedule updates and handle common errors. Automation avoids manual refresh, ensures up-to-date data and enables alerts when something fails.

Prerequisites

  • Account with access to the workspace in Microsoft Fabric and Admin/Manage permissions.
  • Power BI report already published in the Fabric workspace.
  • Azure Active Directory App registered with permissions for Power BI (Dataset.ReadWrite.All) and a Client Secret.
  • Basic familiarity with HTTP and JSON files; curl or PowerShell available.

Step 1: Register an AAD App and obtain a Client Secret

We need an AAD App to authenticate and call the Power BI REST API from the Pipeline. In the Azure Portal create an App, set a Redirect URI (optional for client credentials) and generate a Client Secret. Note the Tenant ID, Client ID and Client Secret — they will be used later.

Step 2: Grant Power BI permissions to the AAD App

In the Azure portal, under the App's API permissions, add the permission "Power BI Service" -> "Application" -> "Dataset.ReadWrite.All" and click "Grant admin consent". This allows the app to manage dataset refresh.

Step 3: Obtain an access token (example with curl)

Use the client_credentials flow to get an OAuth2 token. Replace the placeholders with your Tenant ID, Client ID and Client Secret.

curl -X POST https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0/token \   -H "Content-Type: application/x-www-form-urlencoded" \   -d "client_id={CLIENT_ID}&scope=https%3A%2F%2Fanalysis.windows.net%2Fpowerbi%2Fapi%2F.default&client_secret={CLIENT_SECRET}&grant_type=client_credentials"

Step 4: Identify Dataset ID and Group (workspace) ID

To trigger the refresh we need the datasetId and the groupId (workspace). Use the API to list datasets in the workspace. Replace {ACCESS_TOKEN} and {GROUP_ID}.

curl -H "Authorization: Bearer {ACCESS_TOKEN}" \   https://api.powerbi.com/v1.0/myorg/groups/{GROUP_ID}/datasets

Step 5: Create a Pipeline in Fabric to call the API

In Microsoft Fabric create a Pipeline (Data Factory) that runs a simple Web activity. The Pipeline organizes and schedules the call. Create a Linked Service of type "REST" or use a Web activity with appropriate headers and payload.

Step 6: Configure the Web activity to trigger the refresh

Configure the Web activity to do a POST to the dataset refresh endpoint:

POST https://api.powerbi.com/v1.0/myorg/groups/{GROUP_ID}/datasets/{DATASET_ID}/refreshes
Headers:
  Authorization: Bearer {ACCESS_TOKEN}
  Content-Type: application/json
Body:
  { "notifyOption": "MailOnCompletion" }

Optionally use {notifyOption: "NoNotification"} and handle notifications through another system.

Step 7: Handle response and common errors

Add logic in the Pipeline to check the HTTP code and the JSON body. Common errors: 401 (invalid token), 403 (insufficient permissions), 404 (wrong dataset or workspace). If you receive 202, the refresh was accepted; you will need to query the status later.

Step 8: Check the refresh status

If you want to confirm the refresh result, call the refresh history or dataset status API:

GET https://api.powerbi.com/v1.0/myorg/groups/{GROUP_ID}/datasets/{DATASET_ID}/refreshes
Headers:
  Authorization: Bearer {ACCESS_TOKEN}

Check the "status" field (Completed, Failed, Unknown) and the "endTime" to validate success.

Verify the result

Validate that the Pipeline runs without errors in Microsoft Fabric and that the REST API call returns 202 or 200 depending on the endpoint. Check in the Power BI service: the report should show updated data and the dataset refresh history should record the run with status Completed. In case of failure, review the token, permissions and IDs used.

Conclusion

Automating Power BI refresh in Microsoft Fabric using Pipelines and the REST API allows scheduling and monitoring dataset updates without manual intervention. Next steps: add retries, notifications via e-mail/Teams and integration with Workspace logs for diagnostics. Try monitoring refresh duration and ask yourself: what is the acceptable refresh window for your users?