Forum Discussion
Update a single Power BI table using Power Automate
After a lot of days I finally came up with a solution. Basically, the only way to update a single Power BI table beyond XMLA endpoints, is to use the Power BI Rest API. The only thing that you need to do before calling the Refresh endpoint, is to get the access token, which you need to pass as a Bearer token to the refresh endpoint, and this was the reason why I was getting 403.
From what I have tried, I wasn't able to pass the Bearer token to the the second custom connector of my Power Automate Flow, which had to execute the refresh of the table, so I don't know if it is actually possible to do that, but I managed to solve in another way, so I report what I did below in case someone could find this helpful.
Given that I was also using a Python Rest Service with Flask, and given that I was calling an endpoint with my second custom connector in my flow above, I directly refreshed the Power BI table at the end of the endpoint by using Python. In order to do this, as I have already said above, you first need to retrieve an access token: I found this guide very helpful, in particular in the REST section, where he put the Python code snippet needed to do so (the username is your Power BI email and same for the password).
For the client_id, you need to register an app on Azure, but the link also showed in the Youtube video that the guide provides didn't work as expected for me, so you need to go at this link to register the app (I chose Embed for your customers).
Then, in addition to what the guide says, I also granted the Read All Datasets permission and, as stated in the authentication section, on Azure in the Authentication section under Management I inserted https://api.powerbi.com as redirect url.
After all this, you should be able to retrieve your bearer access token.
Then you can finally refresh a single table in Power BI, for example by passing a body like the one you find in this blog. In my case I also did this with Python.
I hope I can help someone else 🙂