How to embed a Power BI report into an application for your customers

How to embed a Power BI report into an application for your customers

Power BI Embedded in Azure provides us with the ability to embed reports, dashboards or tiles into an application by using app owns data. App owns data typically means having an application that uses Power BI as its embedded analytics platform. As an ISV developer, you can create Power BI reports in an application that is fully interactive, and the end users of the application will not require a Power BI license to view the report content.

Why do you need analytic solution embedded into your app?

  • Embedding Power BI helps ISVs or developers to embed visuals into customer applications and assist them in making better decisions without building an analytical solution.
  • Embedding analytics helps business users to access their business data and perform required actions to generate valuable insights using this data within the application.
  • Minimize development efforts and achieve faster time to market with your application.
  • Spend more time focusing on your product rather than developing visual analytics features from scratch.
  • Deliver value for your customers by easily exploring data and gaining insights from anywhere.

In this blog, I will explain how you can integrate a Power BI report into an application using Power BI .NET SDK. Here you are using Power BI Embedded in Azure for your customer using app owns data.

Prerequisites

  1. A Power BI Pro account, sign up for a free trial
  2. A Microsoft Azure subscription, create a free account
  3. Set up your own Azure Active Directory tenant setup.
  4. Visual Studio (version 2013 or later).

Part 1 – Registering your application in Azure Active Directory (Azure AD)

  1. To establish an identity for your application and to specify permissions to Power BI REST resources you need to register your application in Azure AD.
  2. To register your application, your Azure AD should also have the rights to give permissions.
  3. Go to Azure Portal and then go to Azure AD.
  4. Go to App Registrations and click on New application registrations.
  5. Follow the prompts and create a new application. After filling this up, it should look like this.

Registering your application in Azure Active Directory

You need to enable additional permissions for your application.

  1. Click on Settings of the application you just created and click on Required Permissions

click on Required Permissions

  1. Click on Windows Azure Active Directory and click on all the Delegated Permissions and click on Save.
  2. Now click on Add and add Power BI Service API

Power BI Service API

  1. Select all permissions under Delegated Permissions and Select Save when done. Remember you can only grant the permissions if your account has Global Admin rights.

API permissions

Part 2 – Setting up Power BI Service Environment

  1. To embed reports for your customers, you need to place your reports into an app workspace. The master account must have admin rights for the workspace.
  2. Create an app workspace by selecting workspaces > Create app workspace. This is where you are going to publish your Power BI report.
  3. Open your Power BI file in Power BI desktop and publish the report to the workspace you have created. Now, you can view the report in Power BI service.

Part 3 – Embedding the report into your application

  1. For demo purpose, download the App Owns Data sample application code provided by Microsoft.
  2. To embed the Power BI report into your application, you need to fill five fields in order to run the application successfully. These are application ID, group ID, report ID, power BI username and password.
  3. Open the Web.config file in the sample application; this is where you must fill all these IDs.
  4. Fill in the application ID field with the application we created from Azure. The application ID is used by the application to identify itself to the users from whom you’re requesting permissions.
  5. In the Azure portal, select All Services and select App Registrations and click on the application you have created in Part 1. We need to take Application ID from here.

Azure portal

  1. Now, open your Power BI report in Power BI service. From this URL you will get workspace ID and report ID.
  2. From this URL, workspace ID will be 1a8d021d-9bfd-47a0-966f-c2d181449b26.

workspace ID

  1. From this URL the report ID will be 8ecc94fa-fe19-41f5-968e-725989ede165.

workspace ID

  1. The first ID written after groups is the Workspace ID while the second ID written after reports is the Report ID.
  2. So, now we have all the three IDs required. Put them in the Web.config file along with the username and password of the Power BI master account.
    embed power bi report
  3. Then, Run the application and you can view the report in the sample application.

Part 4 – Move to production

After you’ve completed developing your application, you have to back up your app workspace with a dedicated capacity. This dedicated capacity is required to move to production.

A dedicated capacity will give you an advantage of having a dedicated resource for your customer. You can purchase a dedicated capacity at Azure portal.

Use the table to determine which Power BI Embedded capacity is suitable for your need.

Power BI Embedded

  1. Sign into the Azure portal and select Create a resourceData + analytics.
  2. Search for Power BI Embedded and within Power BI Embedded, select Create.
  3. Fill in the required information and then select Create.

azure workspace

  1. Assign your app workspace to dedicated capacity.
  2. Finally, after you have created a dedicated capacity, assign your app workspace to that dedicated capacity.
  3. In the Power BI service, expand workspaces and click on the ellipsis for the workspace you’re using for embedding your content and then click on Edit workspaces.

Power BI service

  1. Click on Advanced and enable Dedicated capacity, then select the dedicated capacity you have created and click on Save.

These are the steps to embed a Power BI report into your customer’s application. We have started by registering our application in Azure AD, then we have setup our Power BI environment. Then we have embedded our report into the application by updating our application’s code. Finally, to move to production, we have created a dedicated capacity to backup our app workspace and our Power BI report is embedded into our application.

Power Bi Reports

Get in touch with us to meet your specific information needs and make better decisions with Power BI solutions.

Let's connect to make technology work for you.





Project Portfolio ManagementCloud AdoptionAdaptive BIDigital WorkspaceConsulting


Posted by Deepesh Vashistha

Related Posts:

No Comments

Leave a Reply

Your email address will not be published.

*
*

17 + 13 =