When you’re working with Power Automate and need to track the refresh status of a Power BI dataset, it can be a bit tricky due to the way the Refresh a dataset action behaves. Let’s dive into this topic and explore some approaches.
Initial Behavior:
When you trigger a dataset refresh using the Refresh a dataset action, it immediately returns a status code of 202.
However, this doesn’t necessarily mean the refresh is complete; it simply indicates that the refresh process has been initiated.
Desired Outcome:
Ideally, you want to confirm that the refresh has indeed completed successfully.
To achieve this, you need to check the status code after the refresh has finished.
Challenges:
Unfortunately, directly querying the status code during the refresh process always returns 202, even if the refresh is still ongoing.
So how can we get the status to update once the refresh is truly complete?
Solutions:
Option 1: Polling with a Timeout
Use a Do-While loop to repeatedly check the refresh status.
Inside the loop, make an HTTP request to the Power BI API to retrieve the refresh history.
Parse the response to determine whether the refresh is still running or has completed.
Adjust the loop timeout based on your dataset’s typical refresh duration.
Option 2: Custom Connector and API Call
Create a custom connector in Azure AD.
Configure the connector to make a GET request to the Power BI API endpoint for refresh history.
Extract the relevant information from the API response (e.g., whether the refresh is still running or has finished).
Use this data to provide real-time feedback to users.
Option 3: Review Refresh History in Power BI
Navigate to Settings > Dataflows > Refresh History within Power BI.
Here, you can see the historical refresh status for your dataflows.
While this doesn’t give real-time updates during the refresh, it provides valuable insights afterward.
Remember:
The Power Platform offers powerful integration capabilities between Power BI and Power Automate.
By combining these services, you can automate processes and enhance your data workflows effectively
Comments