Our Blog

Embed power BI visualizations into application

Plamen Penev
by Plamen Penev on Thu 30 June 2016 No comments

Microsoft Power BI Embedded enables you to integrate Power BI reports into your web or mobile applications so you don’t need to build custom solutions to visualize data for your users. Customers can view your Power BI reports in custom applications without the need to login or provide office365 credentials to view these reports.

To be able to use Power BI embedded you need the following:

  • A power BI report that you have created & saved in pbix file format.
  • Azure subscription because we need to provision Power BI workspace collection that will host our reports
  • An application to integrate these reports to

pic1

Fig. 1 Power BI embedded report architecture

Use power BI Desktop tool to select a data source and create a custom report.

There are different types of available sources – Excel, CSV, XML, JSON files, SQL, Azure SQL Databases, etc. Power DI Desktop provides a different variety of charts that are easily configurable for visualizing data. There are options to use DirectQuery to data source which means using the “real” data and option to import data source. More about Power BI Desktop tool you can find here: https://powerbi.microsoft.com/en-us/documentation/powerbi-desktop-getting-started/.

Publish my power BI report to Azure workspace

First we need to create new Azure Workspace Collection from New -> Data + Analytics -> Power BI Embedded menu.

pic2

After Workspace collection is created it is empty. We need to create workspaces and to upload out pbix file to it. The easiest way it to use a tool which is available here https://github.com/Azure-Samples/power-bi-embedded-integrate-report-into-web-app/ and provides options to manage out workspaces. Start ProvisionSample project and you will see this screen:

pic3

Select option 5 – Provision new workspace in an existing workspace collection. We will be asked to enter a name and access key which can be found in you Workspace collection -> Access Keys menu.

pic4

After a workspace is created we need to upload our power BI report. We will use the same tool but will select option 6 – Import PBIX Desktop file into an existing workspace. We will be asked to enter a report name, workspace id and access key. After few seconds out report will be uploaded.

The last step is to create an application to embed the uploaded reports. You can find such an application in the same solution. All we need is to configure it to use out workspace – we need to fill few fields in the web.config file of EmbedSample project.

<appSettings>

<add key=”powerbi:AccessKey” value=”” />

<add key=”powerbi:ApiUrl” value=”https://api.powerbi.com” />

<add key=”powerbi:WorkspaceCollection” value=”” />

<add key=”powerbi:WorkspaceId” value=”” />

</appSettings>

Microsoft.PowerBI.API reference is used to easily access the published reports in Azure. It contains methods to create a user token based on workspace collection name and ID and methods to access the published BI reports using the generated token.

pic5

On the left panel is a list of all published power BI reports and displayed is the selected one.

More information about power BI embedded and samples can be found here https://azure.microsoft.com/en-us/documentation/articles/power-bi-embedded-get-started-sample/

 

 

Plamen PenevEmbed power BI visualizations into application

Join the conversation