Power BI Dataset Refresh Failure Alert
Scheduled flow polls the Power BI REST API via HTTP for dataset refresh history. When a refresh failure is detected, logs the failure details to a Dataverse monitoring table and posts a Teams alert to the BI admin channel with dataset name, error message, and workspace link.
Provided as-is, without warranty of any kind. Review and test each pattern in a non-production environment before deploying it to live automations. See our Terms.
Overview
This flow monitors Power BI dataset refreshes across a specified workspace and alerts the BI admin team when failures occur. It polls the Power BI REST API on a recurring schedule, checks each refreshable dataset's latest refresh status, logs failures to a Dataverse tracking table, and posts a formatted alert to a Teams channel with dataset names, error details, and recommended remediation steps.
Trigger: Recurrence — every 6 hours.
Use Case
Power BI dataset refresh failures often go unnoticed until stakeholders report stale dashboards. This flow provides proactive monitoring by scanning datasets, filtering to refreshable ones, checking their latest refresh status, logging failures to Dataverse for historical tracking, and posting a formatted Teams alert with failure count, dataset details, error messages, and remediation guidance.
The flow is ideal for teams that:
- Scanning all datasets in a workspace every 6 hours
- Filtering to only refreshable datasets (skipping live/DirectQuery)
- Checking the most recent refresh status for each dataset
- Logging every failure to Dataverse for historical tracking and Power BI dashboards
- Posting a formatted Teams alert with failure count, dataset details, error messages, and remediation guidance
Flow Architecture
Recurrence
RecurrenceFires every 6 hours.
Initialize Variables (10x parallel)
Initialize variableBinds 8 environment variables plus 2 working variables (varFailureAlertHtml, varFailureCount) in parallel branches.
List Datasets In Workspace
HTTP (GET)Calls the Power BI REST API GET /v1.0/myorg/groups/{workspaceId}/datasets using ActiveDirectoryOAuth (audience https://analysis.windows.net/powerbi/api).
Parse Dataset List
Parse JSONExtracts dataset id, name, configuredBy, and isRefreshable from the API response.
For Each Dataset
Apply to eachFor each dataset returned by the API: check if refreshable, fetch latest refresh history, evaluate the result, and log/alert on failure.
If Refreshable
If conditionSkips non-refreshable datasets (DirectQuery, live connections) using @items('For_Each_Dataset')?['isRefreshable'].
- Get Latest Refresh History — HTTP GET /datasets/{id}/refreshes?$top=1 with ActiveDirectoryOAuth.
- Parse Refresh Result — Parse JSON to extract status, startTime, endTime, and serviceExceptionJson.
- Check If Refresh Failed — Nested If condition testing length(value) > 0 AND status == 'Failed'. On true: log failure to Dataverse, append a styled HTML row to varFailureAlertHtml, and increment varFailureCount.
Environment Variables
| Schema name | Type | Default | Description |
|---|---|---|---|
| flowlibs_TeamsGroupId | String | <configure> | M365 Group ID for the Teams alert channel that receives Power BI refresh failure notifications. |
| flowlibs_TeamsChannelId | String | <configure> | Channel ID within the Teams group where the failure alert is posted. |
| flowlibs_AdminNotificationEmail | String | alerts@yourcompany.com | Fallback notification recipient for the BI admin team. |
| flowlibs_PowerBIWorkspaceId | String | <configure> | GUID of the Power BI workspace to monitor. Found in the Power BI workspace URL. |
| flowlibs_GraphTenantId | String | <your-tenant-id> | Azure AD tenant ID used for ActiveDirectoryOAuth authentication against the Power BI Service API. |
| flowlibs_GraphClientId | String | <configure> | Azure AD app registration client ID. The app must have Dataset.Read.All permission on the Power BI Service API. |
| flowlibs_GraphClientSecret | String | <configure> | Client secret for the Azure AD app registration used to authenticate Power BI REST API calls. |
| flowlibs_PBIRefreshFailureTable | String | flowlibs_pbirefreshfailures | Dataverse entity set (plural) name used to log Power BI refresh failures. |
Connectors & Connections
| Connector | API name | Actions used |
|---|---|---|
| HTTP | http | HTTP (Calls Power BI REST API endpoints (list datasets, get refresh history) using ActiveDirectoryOAuth.) |
| Microsoft Dataverse | shared_commondataserviceforapps | CreateRecord (Logs each refresh failure to the flowlibs_pbirefreshfailures table.) |
| Microsoft Teams | shared_teams | PostMessageToConversation (Posts the styled HTML alert to the configured Teams channel.) |
Note — All connections are referenced as solution connection references; the flow is portable between environments as long as a connection is mapped at import time.
Customization Guide
Almost every realistic variant of this flow can be implemented by changing environment variable values. A few cases require small edits inside the flow definition — those are called out explicitly below.
- Set the Power BI Workspace ID
- Update flowlibs_PowerBIWorkspaceId with the GUID of the workspace you want to monitor. You can find this in the Power BI workspace URL.
- Register an Azure AD app for Power BI access
- Create an app registration with the Dataset.Read.All application permission on the Power BI Service API. Set flowlibs_GraphClientId, flowlibs_GraphClientSecret, and flowlibs_GraphTenantId with the app's credentials and your tenant ID.
- Configure the Teams alert channel
- Set flowlibs_TeamsGroupId and flowlibs_TeamsChannelId to point at your BI admin alert channel so failure notifications land in the right place.
- Adjust scan frequency
- Modify the Recurrence trigger interval (default: every 6 hours) to match how aggressively you want to detect refresh failures.
- Authorize connections and turn the flow on
- Open the flow in the designer, authorize the Dataverse and Teams connections, then switch the flow state from Off to On.
- Provision the Dataverse logging table
- Create a flowlibs_pbirefreshfailure table (entity set flowlibs_pbirefreshfailures) with columns: flowlibs_name (PK string), flowlibs_datasetid, flowlibs_datasetname, flowlibs_errordetails (string 4000), flowlibs_workspaceid, flowlibs_refreshstatus, and flowlibs_refreshdate (datetime).
Key Expressions
The flow is intentionally light on Power Fx / WDL gymnastics — the heaviest expressions are the branch-name concatenation and the approval outcome check. They are listed below in the order they appear in the flow.
EXPR.01AAD OAuth on HTTP actions
Authentication block used on both HTTP calls to authenticate as the Azure AD app against the Power BI Service API.
EXPR.02Refreshable dataset filter
Condition expression used to skip DirectQuery and live-connection datasets that have no refresh history.
EXPR.03Failure detection
Tests that the refresh history returned at least one entry and that the most recent entry's status is Failed.
EXPR.04Null-safe error extraction
Falls back to a friendly string when serviceExceptionJson is missing from the refresh history response.
EXPR.05Dynamic Dataverse record name
Generates a unique, human-readable primary-name value for each failure row written to Dataverse.
Comments
Sign in to join the conversation.
Sign inNo comments yet. Be the first to share your experience with this flow.