Coder Social home page Coder Social logo

Comments (8)

v-MadhavC avatar v-MadhavC commented on September 23, 2024 1

Hello, in order to embed a Power BI report using powerbi-client-angular we have to pass reportID, embedURL and embedToken. In order to generate embedURL and embedToken for you Power BI report please follow the following documentations:

Embed URL:
In order to generate embed URL we need to pass groupID.
https://learn.microsoft.com/en-us/rest/api/power-bi/reports/get-reports-in-group#code-try-0

Embed Token:
In order to generate embed Token we need to pass groupID and reportID along with the requestBody.

image

https://learn.microsoft.com/en-us/rest/api/power-bi/embed-token/reports-generate-token-in-group#code-try-0

Hope this helps, if you still have some queries, please feel free to reach out to us.

from powerbi-client-angular.

RupenAnjaria avatar RupenAnjaria commented on September 23, 2024 1

@KotanaSai21 Please close this as I was able to integrate after allowing the Entra app in powerbi workspace.

from powerbi-client-angular.

RupenAnjaria avatar RupenAnjaria commented on September 23, 2024

Thank you for the quick response. This was really helpful as I was able to integrate my report.

Questions:

  1. Is there any authentication for those APIs? or just passing GroupId and Reportid is enough.
  2. Will GroupId stay same for all my PowerBI reports within my company? I believe so.
  3. May I please see what is the code for https://aka.ms/CaptureViewsReportEmbedConfig? I mean, what is it doing behind the scene? Is it calling two APIs and combining the results?
  4. Is there any way we can get Embed URL and ReportID straight from the PowerBI portal?

Thanks again.

from powerbi-client-angular.

v-MadhavC avatar v-MadhavC commented on September 23, 2024
  1. The Authentication type is based on the scenario in which you are trying to embed your Power BI content:
  2. Yes, if all the Power BI reports within your company are in the same workspace. Group ID is basically an unique ID for your Power BI workspace. All the reports in same workspace will have same Group ID.
  3. Please refer to this repository: powerbi-embedded-React-demo/GenerateToken.csx
  4. Yes, you can get both Embed URL and Report ID from Power BI Service.
    • Embed URL: Open a report, click on file on the top left corner, click on Embed report, click on Website or portal.
    • Report ID: open the report, You will be able to see Report ID in the URL.

Hope this helps, please reach out to use in case of any other queries.

from powerbi-client-angular.

RupenAnjaria avatar RupenAnjaria commented on September 23, 2024

That was helpful and I am seems making progress, however regarding the URL you shared (https://learn.microsoft.com/en-us/rest/api/power-bi/reports/get-reports-in-group#code-try-0) I am just curious about from where does it gets the token in the playground section:

See the image below:
image

This is the only last piece where I am stuck.

I tried to bet token like this:

https://stackoverflow.com/questions/77796971/getting-bearer-access-token-for-powerbi

but that didn't work and gave me 401 unauthorized error.

from powerbi-client-angular.

KotanaSai21 avatar KotanaSai21 commented on September 23, 2024

@RupenAnjaria ,
The Error you're facing while getting the Embed URL PowerBINotAuthorizedException is due to either Unauthorized group or wrong group Id. Refer Troubleshoot documentation for the Error details.

Refer to this documentation Embed using service principal. Follow the steps, where you need to add service principal to your workspace. Then You would be able to hit the API and get the Embed URL.

Feel free to reach out if you have any other queries.

from powerbi-client-angular.

RupenAnjaria avatar RupenAnjaria commented on September 23, 2024

Sure, but I am able to integrate the report even without these settings.
Here is what I did:

  1. Visit sample
  2. Copy the Bearer token
  3. Make a call to https://api.powerbi.com/v1.0/myorg/groups/{groupid}/reports/{reportid} using the token
  4. Copy the EmbedURL from the response
  5. Use above values (token and URL) in your Angular demo app (in app.component.ts:
    // Update the reportConfig to embed the PowerBI report
    this.reportConfig = {
      ...this.reportConfig,
      id: '{reportID}', //reportConfigResponse.Id,
      embedUrl: '{embedURL}',  //reportConfigResponse.EmbedUrl,
      accessToken:  '{token}', //reportConfigResponse.EmbedToken.Token,
    };

if I take a token from it is working fine. So not sure if we have to make additional changes in the Entra. Please suggest.

from powerbi-client-angular.

jaspreet1234567 avatar jaspreet1234567 commented on September 23, 2024

@RupenAnjaria - From where you getting the bearer token? I am bit confused here. Here is my understanding, Please correct me if I'm wrong:

  • First get the bearer token from azure active directory.
  • Then by using this token, get the embed url and embed token.
  • Pass this embed token and url in config to embed the report.

Thanks in advance.

from powerbi-client-angular.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.