Closed RupenAnjaria closed 10 months ago
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.
Thank you for the quick response. This was really helpful as I was able to integrate my report.
Questions:
Thanks again.
Hope this helps, please reach out to use in case of any other queries.
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:
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.
@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.
Sure, but I am able to integrate the report even without these settings. Here is what I did:
// 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.
@KotanaSai21 Please close this as I was able to integrate after allowing the Entra app in powerbi workspace.
@RupenAnjaria - From where you getting the bearer token? I am bit confused here. Here is my understanding, Please correct me if I'm wrong:
Thanks in advance.
As per the code we are calling an API: https://aka.ms/CaptureViewsReportEmbedConfig This API returns token and other details. I don't understand what the API URL is doing? is it just returning some hardcoded data? If I have a PowerBI report then how can I generate these details?
Thank you.