Refreshing a Power BI Dataset using an HTTPS URL
I have found that sometimes there are other systems that are loading data, and once they are complete they then want to refresh the Power BI Dataset.
Another way to do this is to use Power Automate, in which a system or user can request a HTTPS URL and once called that will then refresh the Power BI dataset.
I explain how to do this in the steps below.
Creating the Power Automate Flow
In the steps below I will show you how to create the Power Automate Flow.
The first step is to create a Instant flow
Then in the next step I gave it the name of PBI Refresh dataset from URL, and then clicked on Skip because I want to configure this with the steps I require.
I then searched for and selected “When an HTTP request is received”
NOTE: This is a premium step, but I have found it to be invaluable for allowing people to easily connect to flows.
I then expanded the step “When an HTTP request is received”, and changed the method from POST to GET
The reason for using the GET method is that this can be used from any browser by simply pasting the URL into the browser.
And as it mentions above the URL will be generated after the flow has been saved.
The next step is to configure the refreshing of the Power BI dataset.
I searched for “Power BI refresh dataset”, and then selected “Refresh a dataset”
I then selected my App Workspace and dataset as shown below.
NOTE: I also renamed this step to a meaningful step name making it easier to identify at a later stage.
The final step in my flow was to then send an email notifying users that the dataset refresh has started.
I searched for “send an outlook email”, and then selected “Send an email (V2)
I then put in the email addresses of the users, the subject and what to put in the body of the message.
Once again, I also renamed the step name to a meaningful name.
The only thing to make a note of is that I added in the date/time to my local date/time which I did with the following flow expression below.
formatDateTime(addHours(utcNow(),10),‘yyyy-MM-dd hh:mm’)
What the above is doing is working from the inside out is the following:
-
utcNow(),
- I am getting the date/time from UTC
-
addHours(utcNow(),10),
- I am then adding 10 hours, because my timezone is GMT + 10
-
formatDateTime(addHours(utcNow(),10),‘yyyy-MM-dd hh:mm’)
- Finally, I am formatting the date/time to the format I require.
I then saved my flow.
I then needed to go back to my flows and go back in to get the HTTPS URL.
Now when I went in, I could see the URL as shown below.
To test it I then went to my browser and put in the HTTP GET URL
I then got the email confirming that the flow had completed.
And I could also see in the Power BI Service for my dataset that it has been successfully refreshed.
Summary
In this blog post I have shown you how to create a flow which uses an HTTPS URL to start the flow and refresh a Power BI dataset.
I hope that you have found this useful and if you have any questions or comments, please let me know.
Thanks for reading!
[…] Gilbert Quevauvilliers presses the big red button: […]
Hi Gilbert,
Is that possible to retry refresh automatically when datasets refresh get complete and it is failed not succeeded?
Basically it should retry refresh automatically whenever it gets failed.
Thanks
Hi Khushi,
Yes this can be done via Power Automate with the required logic to check if the dataset has been refreshed and if failed to then refresh the dataset.
This is something I could potentially look at a later point in time to blog on.
Thanks
Gilbert
Thanks Gilbert,
By when can we expect the new blog on this topic?