Forum Discussion

Elder's avatar
Elder
Frequent Visitor
3 years ago
Solved

django Authenticate in power bi

I'm new to Azure and Power BI and I would like to know how I can configure Power BI Embedded to allow users to access reports directly on the frontend in a multitenant Django Rest application. Ensuri...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi Elder ,

    You can refer the following links to configure RLS for the embeded report, and it can only use RLS into a standard Power BI app owns data application.

    Embed a report with RLS

    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;
        }

    Enable Row Level Security (RLS) and Embed PowerBI Dashboard in an Application

    Best Regards