Power BI Embedded


Bring the Power into Your Application; Power BI Embedded


Power BI which released at July 2015 targeted business analysts and power users. From that time Power BI group made huge upgrades, and with every improvement the user market of Power BI extended. Recently Power BI step forward with bringing developers as users. Power BI Embedded is the Power BI reporting solution for application developers. In this post I’ll disclose how to begin with Power BI Embedded. In the event that you need to learn more about Power BI read Power BI online book; from Rookie to Rock Star.

What is Power BI Embedded?

Power BI Embedded is the reporting and investigation solution for mobile and web applications. Power BI Embedded is an Azure service that integrates Power BI solution into mobile and web applications. The report despite everything must be authored and created in Power BI Desktop. After creating the report it can be distributed into Power BI workspace in Azure, and utilizing API Keys of Power BI workspace and inserting Power BI report frame into the web/mobile application it will be integrated into the application.

Key Advantages of Power BI Embedded

  • Integrating Power BI into web and mobile applications
  • Application users don’t need Power BI account to view the report
  • Security integration with the application

There are other advantages of using Power BI embedded, but these three are the major two reasons why people will use Power BI embedded. one of them brings the Power of reporting and analysis of Power BI into an application. On the other hand if your application has some users, then they will be able to view Power BI reports without having Power BI account. Security then can be applied easily through workspaces in Power BI Embedded.

Prerequisites For the Sample Report

Power BI embedded is an Azure service, so the very first thing you need in Azure subscription. On the off chance that you don’t have it you can apply for free trial version.

Additionally for this model I will show you a Power BI solution with association with test Azure SQL Database AdventureWorksLT. On the off chance that you don’t have a clue how to set it up, adhere to the instructions in this post to set up AdventureWorksLT Azure SQL DB.

Getting Started with Power BI Embedded

For this model I will utilize a Live/DirectQuery association with Azure SQL DB AdventureWorksLT. The primary reason is that Power BI embedded right now at the hour of writing this post doesn’t support booked refresh, I accept this feature will be accessible very soon. So we should create an example Power BI report in Power BI Desktop. In the event that you don’t have a clue what Power BI Desktop is; read this blog entry: Get Started with Power BI Desktop.

Open Power BI Desktop, Start with Get Data, and Choose SQL Server. Ensure you have checked Live Connection;


After entering credentials for associating with Azure SQL DB you ought to have the option to see rundown of tables. Note that you may need to set up firewall in Azure SQL server to permit your computer IP to pass, on the off chance that you don’t have the foggiest idea how to set it up. read my blog entry about interfacing with Azure SQL DB from Power BI. You just need to read the set up firewall area of it.

From rundown of tables, pick these: Customer, Product, ProductCategory, ProductModel, SalesOrderDetail, and SalesOrderHeader. also, click on Load.

After burden you will see that there is no Data tab in Power BI, and the reason is that we’ve utilized DirectQuery/Live association. with this alternative we won’t have the option to utilize DAX or computations from it in Data tab.


Now let’s create a very simple chart, the chart is a clustered column chart with Color (from Product table) as Axis, and SalesPerson (from Customer) as Legend, and OrderQty (from SalesOderDetail) as Value. 2016-08-04_21h59_32

Now save the report as SampleReport, or any other names you like. We will publish this report into a Power BI workspace in next few steps.

Power BI Workspace Collection

Power BI reports can not be distributed from Power BI Desktop for utilizing with Power BI Embedded. Indeed for utilizing Power BI Embedded, reports ought to be distributed through the application itself. what’s more, it would be distributed to a container or folder under your Azure subscription. This container or folder is Power BI Workspace Collection.

To create the workspace assortment, go to Azure portal (https://portal.azure.com), and create a New Power BI Embedded under Data and Analytics segment.


Now set a name for the Power BI workspace collection, and either use an existing resource group, or create a new one for it.


As you can see creating the workspace collection itself is simple and easy. After creation of Power BI embedded workspace collection, you will see the workspace collection blade opening as below;


Under every workspace assortment there can be one or more workspaces. like folders that has sub folders. Power BI reports will be distributed to workspaces. I will clarify in future posts how you can leverage utilizing different workspaces, for now we should keep it basic and work with just a single workspace.

Sample .NET Projects

As of now there is no graphical user interface choice in Azure portal to create a workspace, so it should be created through an application. since this is the beginning example and I would prefer not to jump into coding here, I’ll be utilizing test Microsoft .NET projects from here.

Download the code above. Note that you need Visual Studio introduced to open this project. There are two projects under Github all under same solution.


For creating a workspace use ProvisionSample project, and right click on it, and from Debug, choose start new instance


This project has the code for creating workspace, and also publishing the report.


** Note that this project is not a utility for deploying Power BI reports, this part can be embedded into your .NET application. This is just an example code for doing the deployment.

Create Workspace

For creating a workspace pick choice 5. it will gets some information about your current Azure subscription key, and work space assortment and will create the workspace for you. It will likewise requests your Power BI workspace assortment Access Keys, which you can discover them under Power BI embedded workspace assortment edge. Be careful that don’t share these keys to others. this would be the admittance to Power BI embedded.


After creating the workspace successfully you should be able to see it under workspace collections in Azure Power BI embedded blade.

Publish Report

To publish report again there is no graphical interface. and you can use same ProvisionSample projecct for publishing. (Number 6 in the list of options to choose);


For publishing the report you need to provide the access key and name of workspace collection, the id for workspace, then name for data set (the name that you want this to be stored), the full path of *.pbix file. Now you see that Power BI report is published.

Update Connection String of the Report

Because we used an Azure SQL DB as the source of connection, we have to update the connection string after deployment. Again you can use same ProvisionSample project with option 7 this time.


Testing the Embedded Report

After refreshing the association information, presently we can test the report. There is another project under this solution named EmbedSample. This project is an ASP.NET MVC solution which already has the Power BI embedded code in the application (I will examine about subtleties of that code in future posts). You should simply to set up the Web.Config of this project to utilize your workspace assortment. Open Web.config and configure lines underneath;


After entering the information for Access Key and workspace collection and workspace id, then you can run this project and in the web application opened, under reports you will see the AdventureWorks Report which will show you the live data as result of DirectQuery connection.


As you can see the Power BI visualization here is exactly same as the visualization in Power BI service itself, and it supports the custom visuals as well. However users can’t edit the report at this stage. they can change the filtering if they want.

Security Thoughts?

One of the big focal points of Power BI Embedded over Power BI distribute to web is that you can set up a security in embedded, while the distribute to web is accessible for everyone. Workspaces can be an approach to set up the security. I will apportion a separate post to this, since this post is already more than sufficiently long. You can pick which users of your application can get to which report pages. right now in the example application the user who signed in is an application user which doesn’t have any Power BI account. However the security for this user can be set explicitly.