How to embed Power BI reports into an application?

MultiTech
5 min readDec 29, 2020

You can embed Power BI reports (Power BI or Paginated), dashboards, or tiles into an application in Power BI by using data owned by the user. Data owned by the customer helps the application to expand the Power BI service such that embedded analytics can be used. This tutorial shows how a report (Power BI or Paginated) is inserted into an application. With the Power BI JavaScript API, you use the Power BI .NET SDK to integrate Power BI into an application for your organization,Further information ,Power BI Course!

Embed Report for Power BI

In Azure, register a submission.

Pre-Requirements

To get started, you must have:

A-Pro accounts for Strength BI.

A subscription to Microsoft Azure.

You need to have your tenant setup for Azure Active Directory.

You need at least a P1 capacity to embed paginated Power BI reports See What size do I need for paginated Power BI reports Premium capacity?

Sign up for a free trial before you start if you’re not signed up for Power BI Pro.

Before you start, build a free account if you don’t have an Azure subscription.

Note

It supports Premium Per User (PPU). If you use the PPU, however, only PPU users in your company will be able to access your solution.

Set up your embedded analytics creation framework

You need to make sure your environment allows embedding with Power BI before you start embedding Power BI reports, dashboards, or tiles into your application.

You should go through the setup tool for Embedding, so you can start and download a sample application easily that lets you walk through an environment and embed a report. Also, you need to assign at least a P1 capability to the generated workspace in the case of embedding a page report.

Moreover, you can proceed below if you want to customize the environment manually.

User Registration in the Azure Active Directory

To grant your application access to the Power BI REST APIs, register your application with the Azure Active Directory. You can set an identity for your application and define permissions for Power BI REST services by registering your application.

Note

You’ll need to navigate to Authentication in your application and enter the redirection address in the Redirect URIs area. See Redirect URI (reply URL) constraints and limitations to learn more about redirecting.

Configure your environment for Power BI

Build a workspace

You have to put the content inside a workspace if you are embedding Power BI reports, dashboards, or tiles for your clients. You may set up various kinds of workspaces: conventional workspaces or modern workspaces.

Build and post your Power BI reports for Power BI

By using Power BI Desktop, you can create your Power BI reports and datasets. Then you can publish a workspace with those papers. To publish in a workspace, the end-user writing the Power BI reports needs to have a Power BI Pro license.

  • Take the demo download
  • Open the .pbix report sample on the Power BI Desktop
  • Report from Sample Power BI Desktop
  • In the workspace, publish.
  • You can now access the report online using the Power BI service.
  • Display a report from a Power BI Desktop
  • Build and post your Power BI reports with page numbers
  • Use the Power BI Report Builder to generate your page Power BI reports. You can then upload the report to a workspace with at least a P1 capacity allocated. To post to a workspace, the end-user uploading the report must have a Power BI Pro license.
  • For demonstration purposes, this sample is intentionally kept plain.
  • To start embedding your content using the sample application, follow the steps below.
  • Digital Studio Download (version 2013 or later). Be sure to download the new kit for NuGet.
  • To get started, download the User Owns Data sample from GitHub.
  • User Owns Sample of Data Application
  • In the sample program, open the Cloud. config file.
  • To run the application, there are fields that you need to fill in.

ID of Application

Use the Application ID from Azure to fill in the application information. The application is used by the application to define the users from which the permissions are sought.

To get the application, perform the following steps.

Log in to the portal in Azure.

Select All Utilities from the left-hand navigation window, and select App Registrations.

Choose the program that requires an application.

App Collection

There is a GUID that is classified as an Application ID. Using this Application ID as your application ID.

ApplicationId

The ID of the workspace

Fill in the WorkspaceID information with the Power BI Workspace (Group) GUID. This information can be accessed either from the URL when you sign in to the Power BI service or from PowerShell.

URL, URL

workspace

With PowerShell

With PowerShell

Copying

“User Owns Embed Test” Embed Test User Owns

PowerShell’s workspace

ID of study

Fill in the report ID information with the Power BI report GUID. This information can be accessed either from the URL when you sign in to the Power BI service or from PowerShell.

URL of Power BI Study

PBI ReportId ReportId

Paginated URL for Study

ReportIdPaginated

With PowerShell

With PowerShell

Copying

Get-PowerBIworkspace -name ‘Embed Test User Holds’ | Get-PowerBIReport

PowerShell’s reported

AADAuthorityUrlAuthority

Fill in the AADAuthorityUrl details with the URL that either helps you to embed with a guest consumer or to embed with your organizational tenant.

In Visual Studio, pick Run.

Then pick Report Embed. In the application, pick the choice based on the material you want to test with — Power BI reports, dashboards, or tiles.

Choose Material

Now, in the sample application, you can view the study.

In the application, view the report

In your submission, embed your content

Even though the Power BI REST APIs will perform the steps to embed your content, the example codes mentioned in this article are made with the .NET SDK.

You use the Power BI REST API or the Power BI C# SDK to incorporate a report into a web app. To get a report, you also use an Azure Active Directory access authorization token. By using the same access token, you then load the report. The Power BI Rest API provides basic Power BI assets with programmatic access. See the Power BI REST APIs and the Power BI JavaScript API for more detail.

Get a token of access from Azure AD

You must get an access token from Azure AD inside your application before you can make calls to the Power BI REST API. See Authenticate users for more details and get an Azure AD access token for your Power BI app.

Receive a Report

You use the Get Power BI reports operation to get a Power BI or paginated report, which gets a Power BI list and paginated Power BI reports. You may obtain a report ID from the list of Power BI reports.

Using an access token, get Power BI reports

A list of Power BI reports is returned by the Get Power BI reports process. From the list of results, you can get a single article.

You must include the Authorization header in the Bearer {access token} format to make the REST API call.

Note

In the Default.aspx.cs file in the sample program, a sample of the material you want to embed is available. Power BI reports, dashboards or tiles are examples.

Conclusion

I hope you got a brief idea about embedding an application into Power BI. You can learn more about reports and embedding reports into applications through Power BI online training.

--

--