Business users today need quick access to reports that deliver faster insights from data. While these reports are built in Power BI, having access to these reports within a custom application is a use case that has grabbed the attention of many business users today. Read more to find out how we were able to bring reporting and analytics to a custom application with Power BI Embedded.
What is Power BI Embedded?
Power BI Embedded is a service in Azure which offers the option to include Power BI reports in custom web applications. Power BI reports reside in Power BI service which is a SaaS platform.
With this, you can embed reports, dashboards, or tiles into an application using App Owns Data. This implies having an application that uses Power BI as its embedded analytics platform.
How does Power BI Embedded help?
- As an independent software vendor (ISV) developer, you have the option to include fully interactive and integrated Power BI resources into a custom application for your customers.
- With Power BI Embedded, you can add embedded analytics into an application with the help of different visuals that help business users to access the business data, perform queries, and generate insights using this data within the application.
- The end user requires no Power BI license to view or interact with the Power BI content.
How to embed Power BI reports in a custom application
Here’s an example of how we used Power BI Embedded in one of our analytics solutions.
We built POINTR, a custom application for one of our retail clients, wherein we integrated a number of reports within the application using Power BI Embedded.
Power BI Embedding involves adding an iframe to a web page and configuring the iframe with a URL and a security token (embed token) to load a Power BI report or dashboard directly from the Power BI Service. The embed tokens are generated using Power BI Pro account credentials in APIs.
Here are the steps involved in embedding Power BI report in a custom application:
- At first, the user launches the application, POINTR in this scenario, from the web browser.
- POINTR then calls to Azure Active Directory to obtain an access token that allows it to call the Power BI Service.
- Then, POINTR calls the Power BI Service API to retrieve data to be embedded about a specific Power BI resource.
- POINTR then passes this data to be embedded along with a security token to the code running in the web browser.
- The third party application (HubSpot) then provides the acknowledgment on successfully running an email campaign.
Embedding Power BI Report in a custom Application comes with a few prerequisites.
- Power BI Pro account, sign up for free trial
- Microsoft Azure subscription, create a free account
- Set up your own Azure Active Directory tenant
- Visual Studio (Version 2013 or later)
Power BI Report Integration
Integration of Power BI Reports using Power BI Embed can be done in 3 steps.
Step 1: Register your application in Azure Active Directory (Azure AD)
- Registering your application with Azure Active Directory allows you to establish an identity for your application and specify permissions (Read, Write and Update) to Power BI REST APIs.
- As in the screenshot below, you need to mention Application name, Application type, Redirect URL and delegate all permissions to API access. To grant permission, Azure user should have the “Global Admin” rights.
- Register application type as Native app as you’re working with a non-interactive login.
Step 2: Setting up the Power BI Service Environment
- In order to embed your Power BI reports in the application, you need to place them in the workspace in the Power BI Service.
- The master account (Power BI Pro account) must be the Admin of the app workspaces used in your application.
- Using Power BI Desktop publish all your reports to workspace used in the application.
Step 3: Embedding Power BI report into your application
- Microsoft provides App Owns Data sample code, which can be downloaded from GitHub.
- You need Visual Studio (version 2013 or later) with the latest NuGet packages to work with it.
- To run the application successfully, you need to mention the following fields in code –
- Application ID: This can be found in Azure Active Directory where you have registered your application
- App Workspace ID & Report ID: This can be found in URL on Power BI Service when you open any report.
- Master Account Username & Password: The credentials of Power BI Pro license account
Apart from this, we also achieved the following functionalities through Power BI SDK/API.
- Custom filters by passing parameters through URLs
- Custom navigation in the web application for reports
- Developed Custom Visuals for reports
- Workflow automation by integration with HubSpot/Mailchimp to create Email Campaigns