Comments (8)
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.
Hope this helps, if you still have some queries, please feel free to reach out to us.
from powerbi-client-angular.
@KotanaSai21 Please close this as I was able to integrate after allowing the Entra app in powerbi workspace.
from powerbi-client-angular.
Thank you for the quick response. This was really helpful as I was able to integrate my report.
Questions:
- Is there any authentication for those APIs? or just passing GroupId and Reportid is enough.
- Will GroupId stay same for all my PowerBI reports within my company? I believe so.
- 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?
- Is there any way we can get Embed URL and ReportID straight from the PowerBI portal?
Thanks again.
from powerbi-client-angular.
- The Authentication type is based on the scenario in which you are trying to embed your Power BI content:
- 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.
- Please refer to this repository: powerbi-embedded-React-demo/GenerateToken.csx
- 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.
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:
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.
@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.
Sure, but I am able to integrate the report even without these settings.
Here is what I did:
- Visit sample
- Copy the Bearer token
- Make a call to https://api.powerbi.com/v1.0/myorg/groups/{groupid}/reports/{reportid} using the token
- Copy the EmbedURL from the response
- 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.
@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)
- Make it possible to set the active page from outside the powerbi-client HOT 1
- Can't work with a low version of angular HOT 1
- TypeError: Cannot read properties of null (reading 'postMessage') HOT 3
- Missing fonts and styles in power bi embedded reports HOT 2
- Doesn't work with Angular 15 HOT 4
- Does powerbi-cilent-angular library supports server side rendering? HOT 2
- Support for reseting a report HOT 6
- FrontLoadException conceptualSchema Exception: Unexpected end of JSON input
- Event Handlers not working for paginated reports. HOT 1
- Embeding PowerBI Desktop Report HOT 1
- Angular 16 Support HOT 5
- Optimization Npm Builed Failed when adding powerbi-client-angular in our Angular 16 app HOT 2
- Want to send additional parameters with request which we made to get the report HOT 2
- The PoberBI report stays in small iframe HOT 3
- How to show two or more PowerBI reports in the same page? HOT 2
- Unexpected results with LayoutSwitch HOT 1
- Property 'changeType' does not exist on type 'VisualDescriptor'.
- Warning CommonJS or AMD dependencies
- NaN issues while using zoom sliders on the visuals HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from powerbi-client-angular.