Search code examples
powerbipowerbi-desktoppowerbi-embeddedpower-bi-report-server

How To Authenticate The End User In The PowerBI


There is one report in the PowerBI.

There are two options to embed it.

A) Private (Website Or Portal) :

List item

In this option, The end-user have to enter the PowerBI account credentitals to see the report.

B) Public (Publish To Web/Public)

enter image description here

In this option, The end-user no need to provide the crendentials to see the PowerBI report.

Query : I want to embed the report in my web. If we chose the Option B, Then anyone who have the link, Can see the report & It's not secure also. But if we chose the Option A, Then the every users will be the login page of the PowerBI in my website and also they must have the PowerBI account to see the report.

So I want to go with Option A, But the end-users must not see the login page from the PowerBI. They will automatically should be authenticated by common PowerBI account programarically.

How can I do it? My website is in the ReactJS.


Solution

  • You can get authenticate on behalf of user and embed the report.

    Refer to my GitHub Repo where I embedded the report in a react app using the powerbi-client-react library and getting Embed parameters from Azure Function App.

    We have React Developer Samples to embed the report, but user needs to login with Master User credentials in order to view embed the report.

    For your requirement, where you don't want the user to login, we need to follow service principal authentication, where you will get authenticated on behalf of user using ClientSecret. MSAL React only supports public Client. So, we need to use Backend capable of holding secret and to get the Embedtoken, one workaround I tried is using the Azure Function App as implemented in my github Repo.