Forum Discussion

essco6's avatar
essco6
New Member
9 years ago
Solved

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 ...
  • MawashiKid's avatar
    9 years ago

    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.


    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:

    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...