Forum Discussion

Boegebjerg's avatar
Boegebjerg
Frequent Visitor
3 years ago

Exporting Power BI Embedded Report to PDF Through Power Automate

We are currently about to embed a Power BI Report on our website, and we want the user to be able to export either the entire report or a specific page to a PDF file.

We have tried to create a Power Automate Flow which, based on a trigger in Power BI, will create the file and send it to sharepoint. The button works well in service, however it does not work in the embedded environment. 

It is strange, that I am able to see the button in the embedded environment, but when I click the button I get this error message in the developer tools console: Uncaught (in promise) Visual [FlowVisual_XXXXX] is not authorized.

I cannot find any solution on how to authorize this FlowVisual. Anybody knows or have an alternative solution to the problem?

Best regards
Michael




2 Replies

  • Hi Boegebjerg ,

     

    Please consider about using the exportToFile API.

    The exportToFile API enables exporting a Power BI report by using a REST call. The following file formats are supported:

    • .pptx (PowerPoint)
    • .pdf
    • .png
      • When you export to a .png, a report with multiple pages is compressed into a .zip file
      • Each file in the .zip represents a report page
      • The page names are the same as the return values of the Get Pages or Get Pages in Group APIs

    Note: This API is only available in for Gen2 capacities.

     

    For more details, please refer to:

    Export Power BI embedded analytics reports API - Power BI | Microsoft Learn

     

    Best Regards,

    Jianbo Li

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

    • Boegebjerg's avatar
      Boegebjerg
      Frequent Visitor

      Hi v-jianboli-msft 
      Thank you for your reply.

      I am aware that this possibility exists through the API. I believe that the step in Power Automate called: "Export To File for Power BI Reports" does exactly this. However, the FlowVisual remains not authorized. 

      I am starting to suspect that the service principal, which hosts our embedded reports, does not have the right permissions. I have tried to give it API permissions in the App Registration module in Azure, but to no avail. Additionally, I can't seem to find this specific API permission in the module (the api permission to be able to export).

      Based on your reply, would it be possible for me to have an API call inside the embedded report which the users can press at will? If so, then this might be a solution. Do you have any information on that?

      Furthermore, I have tested the Power Automate flow in the embedded playground found here:
      https://playground.powerbi.com/en-us/dev-sandbox

      When I psuedo embed our report here, I can successfully export a PDF file. I am not sure what is causing the difference, maybe you can shed some light on it. 

      Best regards
      Michael