Select Page

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>workplaces-> <workplace> -> <data set> -> from query string, capture GUID value after datasets. Use it to populate below scrip <DATA SET>

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

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

Run Script


$url ="<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.