Forum Discussion

Kavindu_SE's avatar
Kavindu_SE
New Member
2 years ago

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

  • 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?

  • 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-urlencoded

     

    i 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?

  • 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.