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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.