1

I'm trying to embed a PowerBI report in my webpage

This code works well WHEN the report has been published on Azure. So, providing the good credentials, everything is OK

var config = {
            type: 'report',
            tokenType: models.TokenType.Embed,
            accessToken: accessToken,
            embedUrl: embedUrl,
            id: embedReportId,
            permissions: models.Permissions.All,
            settings: {
                filterPaneEnabled: true,
                navContentPaneEnabled: true
            }
        };

        // Get a reference to the embedded report HTML element
        var reportContainer = $('#embedContainer')[0];
        // Embed the report and display it within the div container.
        window.powerbi.embed(reportContainer, config);

However, I have some PUBLIC reports.
Absolutely anyone can access them with the url and I'd like to display them the same way I did for "private" reports.

I know I could just do something like :

<iframe src="https://my-public-url" scrolling="no" allowfullscreen="true" style="width: 100%; height: 100%;"></iframe>

But I'd like to know if (and how ?) I could use the window.powerbi.embed method, providing it an object saying : "here is the my-custom-url for the report, but there's no need for token or id, just get it and display it". Obviously, if accessToken or id is null, then nothing is shown...

I've found the very same question here, but non-answered

Can anyone help me ? Thanks a lot

user2687153
  • 427
  • 5
  • 24
  • No, publish to web is completely different method and Power BI JavaScript client can't be used to load such reports. You must authenticate with valid credentials and acquire a token to use this kind of embedding. – Andrey Nikolov Apr 01 '22 at 12:57
  • @AndreyNikolov So how can I embed such a public report ? Only with `` ?? – user2687153 Apr 01 '22 at 13:02
  • If it is yours, then use your credentials embed the original report (not the published URL) using the JS client. If it is not yours, then you can't do much - only what is allowed by the report's author, which in this case is to use the iframe code given to you. – Andrey Nikolov Apr 01 '22 at 13:04

0 Answers0