Embed Power BI content in Salesforce
Salesforce is a world renowned customer relationship management (CRM) solution. 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 using Power BI embedded analytics in a Salesforce environment.
You need to be familiar with both Power BI and Salesforce.
You should have experience developing with Power BI embedded analytics.
You should be familiar with the Salesforce environment; preferably with the salesforce developer experience (SFDX).
Embed for your customers
In the embed for your customers solution, also known as app owns data, you create an embedded application using your own Power BI account. 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:
It's programmed to interact with both Azure AD and the Power BI REST APIs.
It 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 make it possible 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 Lighting 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.
Access the embed for your customers Salesforce developer sample
To embed Power BI content using the embed for your customers Salesforce solution, follow the instructions in the SalesforceAppOwnsDataEmbedding GitHub repository.
Embed for your organization
In the embed for your organization solution, also known as user owns data, you create an embedded application that requires your customers to sign in with their own Power BI credentials. 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 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.
Access the embed for your organization Salesforce developer sample
To embed Power BI content using the embed for your organization solution, follow the instructions in the SalesforceUserOwnsDataEmbedding GitHub repository.