Skip to content

Latest commit

 

History

History
331 lines (188 loc) · 13.4 KB

embed-sample-for-your-organization.md

File metadata and controls

331 lines (188 loc) · 13.4 KB
title description author ms.author ms.reviewer ms.service ms.subservice ms.topic ms.custom ms.date
Embed content in your Power BI embedded analytics application for your organization
Learn how to integrate Power BI into your application to provide insights for your organization by using embedded analytics software and tools.
mberdugo
monaberdugo
powerbi
powerbi-developer
tutorial
01/30/2024

Tutorial: Embed Power BI content using a sample embed for your organization application

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:

[!div class="checklist"]

  • 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:


Method

To create an embed for your organization sample app, follow these steps:

  1. Register a Microsoft Entra application.

  2. Create a Power BI workspace.

  3. Create and publish a Power BI report.

  4. Get the embedding parameter values.

  5. Embed your content.

Step 1 - Register a Microsoft Entra application

Registering your application with Microsoft Entra ID allows you to establish an identity for your app.

[!INCLUDERegister Azure AD app]

Step 2 - Create a Power BI workspace

[!INCLUDECreate a Power BI workspace]

Step 3 - Create and publish a Power BI report

[!INCLUDECreate a Power BI report]

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.

Parameter .NET Core .NET Framework React TypeScript
Client ID :::image type="icon" source="../../media/yes.png"::: :::image type="icon" source="../../media/yes.png"::: :::image type="icon" source="../../media/yes.png":::
Client secret :::image type="icon" source="../../media/yes.png"::: :::image type="icon" source="../../media/yes.png"::: :::image type="icon" source="../../media/no.png":::
Workspace ID :::image type="icon" source="../../media/no.png"::: :::image type="icon" source="../../media/no.png"::: :::image type="icon" source="../../media/yes.png":::
Report ID :::image type="icon" source="../../media/no.png"::: :::image type="icon" source="../../media/no.png"::: :::image type="icon" source="../../media/yes.png":::

Client ID

Tip

Applies to: :::image type="icon" source="../../media/yes.png":::.NET Core :::image type="icon" source="../../media/yes.png":::.NET Framework :::image type="icon" source="../../media/yes.png":::React TypeScript

[!INCLUDEGet the client ID]

Client secret

Tip

Applies to: :::image type="icon" source="../../media/yes.png":::.NET Core :::image type="icon" source="../../media/yes.png":::.NET Framework :::image type="icon" source="../../media/no.png":::React TypeScript

[!INCLUDEGet the client secret]

Workspace ID

Tip

Applies to: :::image type="icon" source="../../media/no.png":::.NET Core :::image type="icon" source="../../media/no.png":::.NET Framework :::image type="icon" source="../../media/yes.png":::React TypeScript

[!INCLUDEGet the workspace ID]

Report ID

Tip

Applies to: :::image type="icon" source="../../media/no.png":::.NET Core :::image type="icon" source="../../media/no.png":::.NET Framework :::image type="icon" source="../../media/yes.png":::ReactTypeScript

[!INCLUDEGet the report ID]

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.

[!INCLUDEEmbedding steps]

  1. 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.

Configure your Microsoft Entra app

[!INCLUDEConfigure the Azure AD authentication options]

  1. In Platform configurations, open your Web platform and in the Redirect URIs section, add https://localhost:5000/signin-oidc.

    [!NOTE] If you don't have a Web platform, select Add a platform and in the Configure platforms window, choose Web.

  2. Save your changes.

:::image type="content" source="media/embed-sample-for-your-organization/azure-ad-net-configurations.png" alt-text="Screenshot of the Azure portal window, which shows the app authentication configurations and the web redirect URI for the .NET core app sample.":::

Configure the sample embedding app

  1. Open the Embed for your organization folder.

  2. Open the embed for your organization sample app using one of these methods:

  3. Open appsettings.json and fill in the following parameter values:

Run the sample app

  1. Run the project by selecting the appropriate option:

    • If you're using Visual Studio, select IIS Express (play).

    • If you're using Visual Studio Code, select Run > Start Debugging.

[!INCLUDEThe embedded application sample app interface]

Configure your Microsoft Entra app

[!INCLUDEConfigure the Azure AD authentication options]

  1. In Platform configurations, configure the following options:

    1. In your Web platform, in the Redirect URIs section, add https://localhost:44300/.

      [!NOTE] If you don't have a Web platform, select Add a platform and in the Configure platforms window, select Web.

    2. In Implicit grant and hybrid flows, enable the ID tokens option.

  2. Save your changes.

:::image type="content" source="media/embed-sample-for-your-organization/azure-ad-framework-configurations.png" alt-text="Screenshot of the Azure portal window, which shows the app authentication configurations, the web redirect URI, and the selected access token option.":::

Configure the sample embedding app

  1. Open the Embed for your organization folder.

  2. Using Visual Studio, open the UserOwnsData.sln file.

  3. Open Web.config and fill in the following parameter values:

Run the sample app

  1. Run the project by selecting IIS Express (play).

[!INCLUDEThe embedded application sample app interface]

Configure your Microsoft Entra app

[!INCLUDEConfigure the Azure AD authentication options]

  1. In Platform configurations, configure your Web platform as follows:

    1. In Redirect URIs, add https://localhost:3000 and select Configure.

      [!NOTE] If you don't have a Web platform, select Add a platform, and in the Configure platforms window, choose Web.

    2. In Implicit grant and hybrid flows, enable both options:

      • Access tokens
      • ID tokens
  2. Save your changes.

:::image type="content" source="media/embed-sample-for-your-organization/azure-ad-react-configurations.png" alt-text="Screenshot of the Azure portal window, which shows the Microsoft Entra app authentication configurations and the web redirect URI set for localhost 3000.":::

Configure the sample embedding app

  1. Open the Embed for your organization > UserOwnsData > src folder.

  2. Using a text editor, open the Config.ts file and fill in the following parameter values:

  3. Save the file.

Run the sample app

  1. Open a terminal and navigate to Embed for your organization > UserOwnsData.

  2. Install the required dependencies by entering the following command:

    npm install

  3. 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.

Related content

Ask the Power BI Community