Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Embedded report for non power bi users with Row level security

As the title says I'm trying to embed a power bi report with the RLS feature. So far I already got the first part done, I'm properly embedding my report using the example from this documentation: ...
  • Anonymous's avatar
    Anonymous
    4 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:

     Work loads Embed token

    Embed Token - Generate Token

    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 Zhou

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.