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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
richanthony
Helper I
Helper I

In Built Report Usage Metrics causing issue when trying embed an RLS enabled report

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?

 

richanthony_0-1669104947702.png

 

 

 

 

 

 

 

3 REPLIES 3
Anonymous
Not applicable

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. 

richanthony
Helper I
Helper I

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?

 

richanthony_0-1669104299369.png

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.