[SalesForce] Embed Power BI into Salesforce

We have just received a requirement where in we have to embed the Power BI reports in to Salesforce. Having no idea about this, I did some googling and found an amazing blog here.

After going through the article, came to know that we need Azure Active Directory for authentication. Is it mandatory to user Azure or we can use other authentication also?

I have following details from client to embed the reports.

Embed Token,Embed URL and Report Id.

Is it possible to embed the reports with the provided information.

Also, the requirement is that as soon as the user logs into salesforce, User should be able to see the reports from Power BI without being asked to log in again to power Bi and We need to use only one user for the authentication. However ever this is something which is not the priority now

Can anyone help me on how to achieve this?

Best Answer

You have all the right resources, as mentioned in the blog

This is based on the OAuth flow, More details on the approach here

To access these reports programmatically we would need the access token, we can route the requests either with one access token or per user (Security is a different topic)

Once you have setup the classes and visualforce page in Salesforce, copy the visualforce page URL which will be in this format: https://xxxxx-dev.my.salesforce.com/apex/powerbireport

Now you have to register this URL as mentioned here:

You will get Application Id and Application secret, copy over these values and follow the blog instructions to put it in custom settings,

  • put in the report id in the visualforce page,
  • preview the page
    • you should see an login link
    • once you click on that, OAuth flow will start and after completion you will be able to see the PowerBI report embedded in salesforce.
    • This will also return a refresh token in case the access token is expired(based on the setup), this allows seamless experience for end user

Note: Storing Application Id and secret in custom setting is not a good approach.

Related Topic