Tutorial: Embed Power BI content using a sample embed for your organization application
Article
Power BI embedded analytics allows you to embed Power BI content, such as reports, dashboards and tiles, into your application.
In this tutorial, you'll learn how to:
Set up your embedded environment.
Configure an embed for your organization (also known as user owns data) sample application.
To use your application, your users will need to sign in to Power BI.
The embed for your organization solution is typically used by enterprises and large organizations, and is intended for internal users.
Important
If you are embedding content for a national/regional cloud, the first few steps of this tutorial are different. See Embed content for national/regional clouds for details.
Code sample specifications
This tutorial includes instructions for configuring an embed for your organization sample application in one of the following frameworks:
.NET Framework
.NET Core
React TypeScript
Note
The .NET Core and the .NET Framework samples allow the end user to view any Power BI dashboard, report or tile they have access to in the Power BI service. The React TypeScript sample lets you embed only one report that your end user already has access to in the Power BI service.
The code samples support the following browsers:
Microsoft Edge
Google Chrome
Mozilla Firefox
Prerequisites
Before you start this tutorial, verify that you have both the following Power BI and code dependencies:
Registering your application with Microsoft Entra ID allows you to establish an identity for your app.
To register your application with Microsoft Entra ID, follow the instructions in Register your application.
Step 2 - Create a Power BI workspace
Microsoft Fabric keeps your reports, dashboards, and tiles in a workspace. To embed these items, you need to create them and upload them into a workspace.
Tip
If you already have a workspace, you can skip this step.
To create a workspace, do the following:
Sign in to Fabric.
Select Workspaces.
Select + New workspace.
Name your workspace and select Save.
Step 3 - Create and publish a Power BI report
Your next step is to create a report and upload it to your workspace. You can create your own report using Power BI Desktop, and then publish it to your workspace. Or, you can upload a sample report to your workspace.
Tip
If you already have a workspace with a report, you can skip this step.
To download a sample report (not Direct Lake enabled) and publish it to your workspace, follow these steps:
Extract the downloaded ZIP and navigate to the Samples Reports folder.
Select a report to embed, and publish it to your workspace.
Step 4 - Get the embedding parameter values
To embed your content, you'll need to obtain a few parameter values. The parameter values depend on the language of the sample application you want to use. The table below lists which parameter values are required for each sample.
Search for App registrations and select the App registrations link.
Select the Microsoft Entra app you're using for embedding your Power BI content.
Under Manage, select Certificates & secrets.
Under Client secrets, select New client secret.
In the Add a client secret pop-up window, provide a description for your application secret, select when the application secret expires, and select Add.
From the Client secrets section, copy the string in the Value column of the newly created application secret. The client secret value is your client ID.
Note
Make sure you copy the client secret value when it first appears. After navigating away from this page, the client secret will be hidden and you'll not be able to retrieve its value.
Workspace ID
Tip
Applies to:
.NET Core
.NET Framework
React TypeScript
To get the workspace ID GUID, follow these steps:
Sign in to Power BI service.
Open the report you want to embed.
Copy the GUID from the URL. The GUID is the number between /groups/ and /reports/.
Report ID
Tip
Applies to:
.NET Core
.NET Framework
ReactTypeScript
To get the report ID GUID, follow these steps:
Sign in to Power BI service.
Open the report you want to embed.
Copy the GUID from the URL. The GUID is the number between /reports/ and /ReportSection.
Step 5 - Embed your content
The Power BI embedded sample application allows you to create an embed for your organization Power BI app.
Follow these steps to modify the embed for your organization sample application, to embed your Power BI report.
Extract the downloaded ZIP and navigate to the PowerBI-Developer-Samples-master folder.
Open one of the following folders depending on the language you want your application to use:
.NET Core
.NET Framework
React-TS
Note
The embed for your organization sample applications only support the previously listed frameworks. The Java, Node JS and Python sample applications, only support the embed for your customers solution.
Open a terminal and navigate to Embed for your organization > UserOwnsData.
Install the required dependencies by entering the following command:
npm install
Run the application by entering the following command:
npm run start
Note
During your first sign in, you'll be prompted to allow Microsoft Entra permissions for the app.
Develop your application
After configuring and running the embed for your customers sample application, you can start developing your own application.
Update user permissions
Users need permission to access the Power BI folder the report is in. When you grant a user permission to access a folder, the change usually takes effect only after the user logs in to the Power BI Portal. For the new permissions to take effect immediately, in the Embedded scenario, make an explicit call to the RefreshUser Permissions REST API at startup. This API call will refresh the permissions and avoid authorization failures for users with newly granted permissions.
Demonstrate methods and best practices that align with business and technical requirements for modeling, visualizing, and analyzing data with Microsoft Power BI.