If you are planning to embed Power BI reports into your web application for Customer, please take the following steps into consideration as a PoC and a quick starting guide:

1. Create RLS for you power bi dataset. I synthesized few records in excel for this PoC

2. Secure the embedded reports: You can use the PowerShell script provided below to generate an embed token manually. However, for non-PoC implementations, it is recommended to consider a middle-tier solution for programmatically generating tokens and implementing ways to refresh them.

  • Navigate to PowerBI.com->workplaces-> <workplace> -> <data set> -> from query string, capture GUID value after datasets. Use it to populate below scrip <DATA SET>

  • Navigate to PowerBI.com->workplaces-> <workplace> -><report> -> capture GROUPS and REPORTS from URL

Run “Connect-PowerBIServiceAccount” first to authnticate to yor PowerBI account

Run Script

#Connect-PowerBIServiceAccount

$url ="https://api.powerbi.com/v1.0/myorg/groups/<GROUPS>/reports/<REPORTS>/GenerateToken";

$body = "{'accessLevel': 'View', 'lifetimeInMinutes': 60,  'identities':[{'username':'<USER>', 'roles':['<ROLE>'], datasets:['<DATASET>']}]}";
$res = Invoke-PowerBIRestMethod -Url $url -Body $body -Method Post


$json = $res | ConvertFrom-Json

“Expiration:  {0} \nToken:  {1}” -f $json.expiration, $json.token

$json.token  | Set-Clipboard

3. Test and validate: Test your integration thoroughly to ensure that the Power BI reports function as expected within your web application.

4. Utilize the Power BI JavaScript SDK to integrate reports into your web app. Follow the SDK’s documentation and examples for guidance.