Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi,
**same post as in the service forum as I am not sure where the question sits best.
we are having a challenge with embedded while using RLS, the inbuilt "Report Usage Metrics" dataset seems to be causing an error because RLS is not enable in it. Has any else eperience this issue amd found a resolution?
Hi @richanthony ,
You may try below code to generate embed token. The report will filter data according to the RLS applied.
public EmbedToken GetEmbedToken(Guid reportId, IList<Guid> datasetIds, [Optional] Guid targetWorkspaceId)
{
PowerBIClient pbiClient = this.GetPowerBIClient();
// Defines the user identity and roles.
var rlsIdentity = new EffectiveIdentity(
username: "France",
roles: new List<string>{ "CountryDynamic" },
datasets: new List<string>{ datasetId.ToString()}
);
// Create a request for getting an embed token for the rls identity defined above
var tokenRequest = new GenerateTokenRequestV2(
reports: new List<GenerateTokenRequestV2Report>() { new GenerateTokenRequestV2Report(reportId) },
datasets: datasetIds.Select(datasetId => new GenerateTokenRequestV2Dataset(datasetId.ToString())).ToList(),
targetWorkspaces: targetWorkspaceId != Guid.Empty ? new List<GenerateTokenRequestV2TargetWorkspace>() { new GenerateTokenRequestV2TargetWorkspace(targetWorkspaceId) } : null,
identities: new List<EffectiveIdentity> { rlsIdentity }
);
// Generate an embed token
var embedToken = pbiClient.EmbedToken.GenerateToken(tokenRequest);
return embedToken;
}
Here I suggest you to refer to this offical blog to learn more details about RLS in Power BI Embed.
For reference: Embed a report with cloud-based RLS
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks for taking the time to reply, In this instance it is the "hidden" Report Usage Metrics dataset that does not have RLS configured that is causing the problem. However from what you have said it looks like you can specify the dataset not just the workspace you want to configure so I will give that ago.
Hi,
we are having a challenge with embedded while using RLS, the inbuilt "Report Usage Metrics" dataset seems to be causing an error because RLS is not enable in it. Has any else eperience this issue amd found a resolution?
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 4 | |
| 3 | |
| 2 | |
| 1 | |
| 1 |
| User | Count |
|---|---|
| 4 | |
| 4 | |
| 4 | |
| 3 | |
| 3 |