Embed Power BI content in Salesforce
Salesforce is a world-renowned customer relationship management (CRM) solution. Power BI embedded analytics lets you embed Power BI content, such as reports and dashboards, in Salesforce.
This article links to two samples that show how to develop by using Power BI embedded analytics in a Salesforce environment. The two developer samples demonstrate two different solutions that enable embedding Power BI content in Salesforce: the embed for your customers solution and the embed for your organization solution.
You must be familiar with both Power BI and Salesforce. It's helpful to have experience developing with Power BI embedded analytics and be familiar with the Salesforce environment, preferably with the Salesforce Developer Experience (SFDX).
Embed for your customers solution
In the embed for your customers solution, you create an embedded application by using your own Power BI account. The embed for your customers solution is also known as an app owns data solution. Your customers don't need to use Power BI credentials to view and interact with the embedded content.
The Salesforce embed for your customers solution uses a service principal and is built on top of an Apex class named
Here are some advantages of the
PowerBiEmbedManager Apex class:
PowerBiEmbedManagerApex class is programmed to interact with both Azure AD and the Power BI REST APIs.
PowerBiEmbedManagerApex class implements Client Credentials Flow when it interacts with Azure AD to acquire an app-only access token. App-only access tokens are important because they allow you to call the Power BI REST APIs under the identity of a service principal, instead of calling under the identity of a user.
The Salesforce embed for your customers solution contains a Lightning Aura component named
powerBiReportAura. When you add an instance of the
powerBiReportAura component to a Lightning application page, you must configure it with a specific Power BI Workspace ID and Report ID. This design makes it possible to add multiple instances of the
powerBiReportAura component, and configure each instance to embed a different Power BI report.
Embed for your customers solution Salesforce developer sample
To embed Power BI content by using the embed for your customers Salesforce solution, follow the instructions in the SalesforceAppOwnsDataEmbedding GitHub repository.
Embed for your organization solution
In the embed for your organization solution, you create an embedded application that requires your customers to sign in with their own Power BI credentials. The embed for your organization solution is also known as a user owns data solution. Signed in customers can view and interact with the embedded content according to their Power BI permissions.
Single page application
The Salesforce embed for your organization Salesforce solution uses a simple single page application (SPA) that implements Power BI reports. The solution is built by using three essential files:
In the Salesforce embed for your organization Salesforce solution,
powerbi.js is used to access the Power BI embedded analytics Client APIs.
Embed for your organization solution Salesforce developer sample
To embed Power BI content that uses the embed for your organization solution, follow the instructions in the SalesforceUserOwnsDataEmbedding GitHub repository.