Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
essco6
New Member

ASP.NET Core example

Has anyone embedded a Power BI report in an ASP.NET Core Web Application or seen a good example of how to do it? I'm struggling to get, store & use the Access token. All the examples that I can find relate to old ASP.NET web applications and the APIs that they use have changed.

1 ACCEPTED SOLUTION
MawashiKid
Resolver II
Resolver II

RE: Has anyone embedded a Power BI report in an ASP.NET Core Web Application

 

PowerBI Embedded is a different approach where Azure is added a layer to render and store the reports.
PBIETopology.png

In your case, “Your app” would refer to your Asp.Net Core 1.1 application app, i.e. all client-side technologies. I did manage to run reports in CORE 1.1 using custom TagHelper pretty similar to the one described in this link.

http://www.hishambinateya.com/power-bi-tag-helper:-part-2-power-bi-embedded 

To embed a PowerBI Embedded report in a an Asp.Net Core 1.1 application, I’ve followed these steps:

 

  1. Create a Workspace collection in Azure
  2. Create a Workspace in Azure
  3. Upload the PBIX to this Workspace
  4. Create a report access token
  5. Render the report in the client-side web page

 

Step 1 was easily done manually on Azure Portal,

https://docs.microsoft.com/en-us/azure/power-bi-embedded/power-bi-embedded-get-started

Steps 2 to 4 process was done using powerbi-cli interface.
[scroll down to Install the Power BI CLI then Create Power BI Workspace section]

http://blog.jongallant.com/2017/01/powerbi-embedded-javascript-api-range-slider-filter/

Note that I could have also used the Provision [C# console app] to manage
similar access token, reportID generation and pbix report upload series of processes. as described in second video section


http://www.mostafaelzoghbi.com/2016/04/power-bi-embedded-step-by-step.html

 

Last but not least step 5... Rendering the report in a Web page...
now that can be achieved using different approaches from Javascript to Asp.Net MVC, Sharepoint web parts, Angular 2 components, and even CORE...
If you take a close look at rendered results, what most processes are basically doing is creating a reusable model which will allow you to render an iFrame to host your report using proper parameters you obtained from steps 2 to 4 ...

Here's the result:

PBIECORE.png

N.B.: Please note that this scenario was used MAINLY for TESTING possibilities purpose. You may no longer be able to use this specific approach in the near future as Microsoft announced Power BI Embedded and the Power BI service are converging with the new arrival of Power BI Premium.
However I won't go too deep on that at this stage... as more detailed information are still to come... and I wouldn't lead anyone in wrong direction. Still hope this helps you deal with the basics in the meantime...

View solution in original post

3 REPLIES 3
MawashiKid
Resolver II
Resolver II

RE: Has anyone embedded a Power BI report in an ASP.NET Core Web Application

 

PowerBI Embedded is a different approach where Azure is added a layer to render and store the reports.
PBIETopology.png

In your case, “Your app” would refer to your Asp.Net Core 1.1 application app, i.e. all client-side technologies. I did manage to run reports in CORE 1.1 using custom TagHelper pretty similar to the one described in this link.

http://www.hishambinateya.com/power-bi-tag-helper:-part-2-power-bi-embedded 

To embed a PowerBI Embedded report in a an Asp.Net Core 1.1 application, I’ve followed these steps:

 

  1. Create a Workspace collection in Azure
  2. Create a Workspace in Azure
  3. Upload the PBIX to this Workspace
  4. Create a report access token
  5. Render the report in the client-side web page

 

Step 1 was easily done manually on Azure Portal,

https://docs.microsoft.com/en-us/azure/power-bi-embedded/power-bi-embedded-get-started

Steps 2 to 4 process was done using powerbi-cli interface.
[scroll down to Install the Power BI CLI then Create Power BI Workspace section]

http://blog.jongallant.com/2017/01/powerbi-embedded-javascript-api-range-slider-filter/

Note that I could have also used the Provision [C# console app] to manage
similar access token, reportID generation and pbix report upload series of processes. as described in second video section


http://www.mostafaelzoghbi.com/2016/04/power-bi-embedded-step-by-step.html

 

Last but not least step 5... Rendering the report in a Web page...
now that can be achieved using different approaches from Javascript to Asp.Net MVC, Sharepoint web parts, Angular 2 components, and even CORE...
If you take a close look at rendered results, what most processes are basically doing is creating a reusable model which will allow you to render an iFrame to host your report using proper parameters you obtained from steps 2 to 4 ...

Here's the result:

PBIECORE.png

N.B.: Please note that this scenario was used MAINLY for TESTING possibilities purpose. You may no longer be able to use this specific approach in the near future as Microsoft announced Power BI Embedded and the Power BI service are converging with the new arrival of Power BI Premium.
However I won't go too deep on that at this stage... as more detailed information are still to come... and I wouldn't lead anyone in wrong direction. Still hope this helps you deal with the basics in the meantime...

Thanks very much for your help. I finally got this working yesterday. I wish Microsoft would make it easier to add the report to the workspace. Surely this is something that you should be able to do in the portal.

I facing the same problem with you. Could you show me how to get and store access token with .Net Core?

 

I couldn't resolve issues when installing "Microsoft.PowerBI.Api" and "Microsoft.IdentityModel.Clients.ActiveDirectory" packages on .Net Core project

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Kudoed Authors