It is simple to embed Power BI Reports, Visuals, Tiles or Dashboards into your web application since Power BI provides a simple-to-implement framework. This is specifically relevant to Independent Service Vendors (ISVs) who do not have to spend time and effort into coding visualizations when they can easily build stunning visualizations using Power BI.
When embedding reports using the Embedded API, we can restrict the functionalities on a more granular level, add more filters that are not available in the actual report, hide specific visuals, and even change the layout of the visuals in the report.
There are three methods to embed Power BI Reports.
1. Publish to Web.
The option “Publish to Web” is available under File Menu when we open the report in Power BI Service.
An embed code is generated, which can be directly inserted into your application.
The disadvantage of this approach is that we cannot enforce any security restrictions on the report, and the data is visible to everyone. Therefore, reports which use Live Connections, and Row Level Security cannot be embedded via this approach.
We can choose to delete existing embed codes through the Power BI Service (Settings -> Manage Embed Codes) if you no longer wish to share the report with the audience.
2. Embed Content for your Organization – UserOwnsData
Embedding Power BI content for your Organization means that User owns the data. The security settings (including row-level security) for the Power BI Reports is carried over and requires the individual application viewers to log in before viewing the embedded reports.
Step 1: Microsoft provides a simple sign up form that registers your application (that would be embedding the Power BI content) in Azure Portal.
After clicking on Register, the Application ID and Application Secret are returned.
As we already have the workspaces and the reports ready in Power BI, we can skip Step 3 and 4.
The Web Application is now registered on Azure, and we can embed Power BI content in it. Please save the Application ID and Application secret, because we would be using it in our application.
Step 2: Configure the Sample Application provided and embed a Power BI Report.
The sample Power BI Application can be downloaded using the Download Sample App button. It is also available at the link below.
In the downloaded application, open the Cloud.config file, and update the Application ID and Application Secret fields.
Update the Workspace ID and the Report ID fields with the values of the Power BI Report you wish to embed.
Step 3: Running the Application
Clicking on the Get Report button embeds the Power BI Report into the web application.
Step 4: Customizing the Web Application to add a Region Filter.
A button “Set Region Slicer” has been added to the web application.
In the Region_Set_Click() function, we construct the filter on Region=”Germany”. We retrieve a reference to the Power BI report from the report container and apply the filter using setFilters().
We can see that the filter has been applied to the report.
Using this API, we can choose to Extend the Power BI context/options menu to add custom functions, change the report layout, hide certain visuals, log the tiles clicked in a dashboard etc.
3. Power BI Embedded for Customers – AppOwnsData
This enables Independent Service Vendors (ISVs) to embed Power BI content for users who do not have Power BI Licenses. A single Power BI Pro License is needed to act as the master account. Power BI Embedded Pricing would apply.
For more details on this implementation, please contact Visual BI here.