Forum Discussion
How to automate Power BI report publishing using Power Automate or REST API
Hi everyone,
I am trying to automate the publishing of a Power BI report. I have manyPower BI workspaces with the same report structure but different data sources.
The Structure
I want to be able to update and publish the report in both workspaces with a single click.
I have tried using Power Automate, but the Publish report action is not yet available. I have also tried using the REST API, but I am having difficulty figuring out how to make the necessary POST request.
Can anyone please provide some guidance on how to automate the publishing of a Power BI report using Power Automate or the REST API? I would greatly appreciate any help you can provide.
Additional details:
- I am using Power BI Desktop version 2.112.1161.0 64-bit (December 2022)
- I have tried using the following Power Automate actions to publish the report:
Use Power Automate HTTP Connector to Publish .pbix File Using the Power BI API – Joel Leichty
but the above solution also not aligned with my problem because the report file (.pbix) needs to be created automatically and we are using different workspaces and datasets(azure sql pools).
I am still unable to successfully publish the report using either Power Automate or the REST API. Any help would be greatly appreciated.
Thank you in advance for your assistance.
5 Replies
- lbendlin
Super User
have also tried using the REST API, but I am having difficulty figuring out how to make the necessary POST request.That seems to be the most promising approach, it is used by a lot of solution providers to automate the provisioning process. What have you tried and where are you stuck?
- PBI_ArchitectNew Member
I am finding difficulty to form the POST request body to import the pbix file to Power BI service.
I tried all the below options:
multipart/form-data
application/octet-stream
application/json
application/x-www-form-urlencodedi used both fileURL and also the file-content. None works. Not a clue where it is going wrong.
If anyone has already done this, can you please share your sample code or steps?
- lbendlin
Super User
You can try it in the sandbox
Imports - Post Import In Group - REST API (Power BI Power BI REST APIs) | Microsoft Learn
- PBI_ArchitectNew Member
I have gone thru all those documentation. I tried all those.I can upload directly from sharepoint when the file size less. When the file size > 1GB, i am not able to upload specify the temporary upload location "fileUrl" in the request body. If you have a sucessfull import of large pbix file (>1 GB) to Power BI service using APIs, pls share the code.
- Syndicate_Admin
Administrator
You have to use the REST API. You can assemble the multipart by following this video https://www.youtube.com/watch?v=6BZAO1r0Ucc. You can't use the HTTP connector with Microsoft Entra ID (preauthorized) because it encodes the body to base64, you have to use the default http connector from power automate. To get the bearer token for POST, you'll need to register an app with Azure and set up permissions.