Forum Discussion
Embedded report for non power bi users with Row level security
- Anonymous4 years ago
Hi Anonymous ,
According to your statement, I know you want to configure RLS in App owns data.
In app owns data, to use your application, your users will not need to sign in to Power BI or have a Power BI license. You need to generate an embed token by code for your end user.
Below is workloads to generate embed token:
For reference:
As this blog mentioned, you need to configure RLS in desktop as normal, and then add rls parameters(identities) into codes when you generate embed token for end user.
You could change the PowerBI-Developer-Samples > .NET Framework > Embed for your customers > PowerBIEmbedded_AppOwnsData sample.
public EmbedToken GetEmbedToken(Guid reportId, IList<Guid> datasetIds, [Optional] Guid targetWorkspaceId) { PowerBIClient pbiClient = this.GetPowerBIClient(); // Create a request for getting an embed token // This method works only with new Power BI V2 workspace experience 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> { rls } ); // Generate an embed token var embedToken = pbiClient.EmbedToken.GenerateToken(tokenRequest); return embedToken; }Best Regards,
Rico ZhouIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
RLS comes in two flavors.
Roles based where you assign DAX rules to roles, and then assign users to roles. This assumes your users are already authenticated
Dynamic RLS where you use USERPRINCIPALNAME() to drive the DAX rules (or use the data model). While this works with users who don't have a Power BI license, these users still need to have authenticated in a way that produces a result for USERPRINCIPALNAME()
In an App Owns Data scenario you have to implement the first version manually. The users must present some sort of user id, but you can then decide how to map that to your RLS roles, most likely as part of your wrapper application that does your authentication.