Power BI Tip: Embedding Power BI Reports

Over the last few months we’ve had the privilege of deploy numerous creative Power BI embedded solutions into custom apps for clients. It is a service which allows users to access Power BI cloud based reports with out need for signing into the powerbi.com service to access the reports within that environment. 

Power BI Embedded Demo

Let’s take a look at three ways of embedding Power BI report into an application:

Power BI Embedded

1 Publish to web

Publishing your report to the web from powerbi.com
Here you can easily bring your report into the iframe of your application. You embed the report using the link generated by “publish to web” feature. This simple method uses a public report URL.

This approach doesn’t allow for viewing reports based on user’s permissions, neither to manage page/report level filters. Be aware, when you use Publish to Web, the report or visual you publish can be viewed by anyone on the Internet. There is no authentication used when viewing these reports. Only use Publish to Web with reports and data that the anyone on the Internet (unauthenticated members of the public) should be able to see.

Steps: go to powerbi.com >  Reports > open your report >  click on File > click Publish to web >create embed code > click Publish > copy your report URL and html iframe code

2016-10-22_20h25_06 2016-10-22_20h25_41 2016-10-22_20h26_10 2016-10-22_20h26_39

 

2 Using the Power BI REST API

In this case you’ll need to create a user account in the Power BI service and assign a Basic/Pro license to every user. Licensing requirements are absolutely same as for the Power BI service itself. Moreover, all users of the application must be authenticated using Azure AD. This approach requires setting up the back-end service to obtain authentication tokensPower BI REST API calls are made on behalf of an authenticated user by passing a token in the “Authorization” header that is acquired through Azure Active Directory

3 Power BI Embedded

Power BI Embedded is an Azure-hosted service which allows users to embed the reports into external applications. The most important advantage of Power BI Embedded is that users don’t need to have a Power BI service accounts and licenses to access Power BI reports via the application. This licensing model is described here:
https://azure.microsoft.com/en-us/documentation/articles/power-bi-embedded-what-is-power-bi-embedded/#licensing-for-microsoft-power-bi-embedded

To ensure the users will have access to the most updated information the Power BI model type must be “direct query” and the data source must be cloud-based (AzureSQL) at this time . When using “Direct Query”, no data is imported or copied into the data model.  As you interact with a visualization, Power BI Embedded queries the underlying data source, which means you’re always viewing current data. You can read more about Direct Query mode here:

https://powerbi.microsoft.com/en-us/documentation/powerbi-desktop-use-directquery/

Of course, you can use “Import data” mode as well, but you’ll need to manually refresh your data sets.

Security

There is no explicit requirement that your end users be customers of Azure Active Directory (Azure AD). Instead, your application expresses to Microsoft Power BI Embedded authorization to render a Power BI report by using Application Authentication Tokens (App Tokens).

In a previous post, I explain how to use Row level security (RLS). RSL can be used to restrict user access to particular data within a report or dataset, this allows for multiple users to use the same report while all seeing different data. Power BI Embedded now supports datasets configured with RLS.

demo
Requirements

You’ll need an Azure account/subscription and from the Power BI Embedded service  > Create Workspace collection > create workspace and then deploy your Power BI Desktop file from this workspace. Below is the flow diagram

flow

Like any other service in Azure, resources for Power BI Embedded are provisioned through the Azure ARM APIs. In this case, the resource that you provision is a Power BI Workspace Collection.


With Power BI Embedded we have three main steps:

Step 1: Developing the Power BI report in Power BI Desktop (Download the free tool here)
Once done developing the report set you will save the Power BI Desktop file (.pbix file)

Step 2: Configuring Azure Power BI and uploading/deploying the Power BI Desktop file.

First, create the Azure Power BI Embedded service and Workspace Collection.
Steps: Azure portal > click new > Intelligence+Analytics > Power BI Embedded > fill the require form as shown below > click create

azure

Once you have created the Power BI embedded service you can find this service in your resources:

service

Note: Take note of the Workspace Collection name , Resource Group and Access Key.

Now that we have created the Power BI Embedded service with Workspace CollectionNext, we have to create a Workspace and upload the Power BI Desktop file to this Workspace. For this, we need a console app which will connect to the Azure Power BI service and upload the file.

We run the console app and  press 5  > follow the instructions (provide the Workspace Collection name, and Access Key)

console

After doing this we will have a new Workspace in our Workspace collection. Next we upload the .pbix file, press 6, and follow the steps in console app. Finally, we have created/configured the Power BI Embedded environment in Azure.

Step 3: Calling the deployed report.

The last step will be to consume the Power BI reports from Azure.
In our sample app we configure the web.config, in the EmbedSample web application and provide the Access key, Workspace Collection  and Workspace id. You can get all these from the Azure Power BI Embedded service.

config

Sample download https://github.com/Azure-Samples/powerbi-dotnet-server-aspnet-web-api

Some additional features you can add is RSL and refreshable report using an azure SQL Database as source for your Power BI report.

Want to get started on this:

power-bi-embedded-get-started-sample

Here is a example of embedding Power BI into a custom app using the Azure services:

Power BI Embedded Demo

This is a fantastic way to consolidate value into one place via a custom app and thereby negating the need to visit the Power BI service to view your reports.

Feel free to contact me if you would like to discuss how best to embed Power BI reports into your app environment.

 

By | 2017-02-06T11:46:13+00:00 December 10th, 2016|Power BI, Power BI Tips|1 Comment

About the Author:

Johann is the founder of Data Bear and specializes in getting the right data into the right hands, in a format that is quick and easy to understand. Revolutionizing your reporting experience from a time consuming frustration into dynamic interactive visualizations is what he takes pleasure in.

One Comment

  1. Denys Chamberland (@MawashiKid) June 19, 2017 at 6:33 pm - Reply

    Hi Johann,

    Good article. Now I have a comment about Power BI Embedded.

    Since the beginning of June 2017, the third Power BI Embedded option is no longer available for development on Azure Portal. That is, if you’re trying to create a new project using the Workspace Collections – Workspace – concept model topology… on your Azure Portal account, you will probably be able to spot the ‘Power BI Embedded’ option listed on a blade, though I’m afraid that’s about as far as you’ll get. Instead of seing the Workspace Collection creation form in the last blade as you normally expected, you’ll rather end up with a document listing steps info which will help you to migrate your Power BI Embedded project to new Power BI API [Premium oriented] approach. So in a way, I’d say that using the word ‘convergence’ is a friendly expression as it now seems obvious Power BI Embedded will no longer be an option and we won’t have any other choice but to adopt Premium licenses. If you already had Workspace created in Resources, then you should still be able to provision those in combination with Power BI Embedded approach for a limited time [a year…], though Microsoft strongly suggests to prepare a migration…
    I fully understand Microsoft decision regarding Premium in large enterprises context.
    Though as a developers, our job is not limited to coding, producing nice charts, but also bringing new people [including SME] to invest in a solution we strongly trusted and believed in.
    As John White mentioned in his article,The Power BI Premium Pricing Model – The Good, The Bad and the Ugly

    https://whitepages.unlimitedviz.com/2017/05/power-bi-premium-pricing-model-good-bad-ugly/

    even at 625$ US / month, the EM1 entry point seems a bit too high to swallow for a considerable amount of SME people.
    As John mentioned, pricing should be a simple problem for Microsoft to solve and I agree with his statement. So in the meantime I guess we’ll have to wait and see… though it still possible to bring opinion and suggestion on forums, you never know. 😉

    Regards

Leave A Comment