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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Embed a report automatically using PowerBI embedded

I am using PowerBI embedded to embed reports for my customers. I have one report per customer in the same workspace.

 

I want to know if there is any feature in PowerBI embedded, so that the embedded report would be different for each customer, without me having to explicitly state which reportID corresponds to which user, to get the embedUrl for the configured report?

 

(Would Power BI Embedded be able to detect which user has logged in, and embed the report for them automatically?)

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

Power BI Embedded does not have a built-in feature to automatically detect which user has logged in and embed the corresponding report for them. However, you can achieve this functionality by building it into your application.

In your application side:

1. Create a mapping between your users and the reports they should see. You can store this mapping in a database or other data store that your application can access. For example, you might have a table that maps user IDs to report IDs.

2. When a user logs in, your application can use the mapping to determine which report to embed for that user. For example, you might retrieve the user's ID from the authentication token and use it to look up the corresponding report ID in your mapping table.

 

3. Use the Power BI REST APIs to retrieve the embed URL for the appropriate report. You can use REST API Reports - Get Reports In Group - REST API  to retrieve a list of reports in your workspace, and then use REST API Embed Token - Reports GenerateTokenInGroup - REST API  to generate an embed token and embed URL for the appropriate report. You will need to authenticate your application to use the APIs. You can use Azure Active Directory to authenticate your application and obtain an access token to use with the APIs.

4. Use the Power BI JavaScript API to embed the report in your application. You can use the 'powerbi.embed' function to embed the report in your application. You will need to pass the embed URL and the access token obtained in step 3 to the 'powerbi.embed' function.

Power BI embedded analytics overview | Microsoft Learn

Best Regards

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @Anonymous ,

Power BI Embedded does not have a built-in feature to automatically detect which user has logged in and embed the corresponding report for them. However, you can achieve this functionality by building it into your application.

In your application side:

1. Create a mapping between your users and the reports they should see. You can store this mapping in a database or other data store that your application can access. For example, you might have a table that maps user IDs to report IDs.

2. When a user logs in, your application can use the mapping to determine which report to embed for that user. For example, you might retrieve the user's ID from the authentication token and use it to look up the corresponding report ID in your mapping table.

 

3. Use the Power BI REST APIs to retrieve the embed URL for the appropriate report. You can use REST API Reports - Get Reports In Group - REST API  to retrieve a list of reports in your workspace, and then use REST API Embed Token - Reports GenerateTokenInGroup - REST API  to generate an embed token and embed URL for the appropriate report. You will need to authenticate your application to use the APIs. You can use Azure Active Directory to authenticate your application and obtain an access token to use with the APIs.

4. Use the Power BI JavaScript API to embed the report in your application. You can use the 'powerbi.embed' function to embed the report in your application. You will need to pass the embed URL and the access token obtained in step 3 to the 'powerbi.embed' function.

Power BI embedded analytics overview | Microsoft Learn

Best Regards

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.