March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
I follow this guide Generate an embed token with RLS to GetEmbedToken with RLS.
But I encountered a problem. This method reported 400 bad request when executing the following method.
var rlsIdentity = new EffectiveIdentity(
username: customerId.ToString(), // Customer Id
roles: new List<string> { "CustomerDynamic" }, // Role name
datasets: new List<string> { datasetId }
);
var tokenRequest = new GenerateTokenRequestV2(
reports: new List<GenerateTokenRequestV2Report>() { new GenerateTokenRequestV2Report(report.Id) },
datasets: new List<GenerateTokenRequestV2Dataset> { new GenerateTokenRequestV2Dataset(datasetId.ToString()) },
targetWorkspaces: workspaceId != Guid.Empty ? new List<GenerateTokenRequestV2TargetWorkspace>() { new GenerateTokenRequestV2TargetWorkspace(workspaceId) } : null,
identities: new List<EffectiveIdentity> { rlsIdentity }
);
var embedToken = pbiClient.EmbedToken.GenerateToken(tokenRequest);
We are developing PBI reports, and currently only one report is configured with RLS, while the other reports are not configured with RLS. Currently all reports that are not configured with RLS are not working. Obviously these reports cannot resolve RLS. How to deal with this situation, can the reports that are not configured with RLS ignore RLS instead of reporting errors?
Solved! Go to Solution.
Hi @JinHe ,
Base on your description, it seems like you got stuck when generating an embed token with RLS. Could you please check the following info?
Create separate methods for generating tokens for reports with RLS
public GenerateTokenRequestV2 CreateTokenRequest(string datasetId, Guid reportId, Guid workspaceId, string rlsRole, string customerId, bool isRLSRequired) var tokenRequest = new GenerateTokenRequestV2( return tokenRequest; var tokenRequest = CreateTokenRequest(datasetId, report.Id, workspaceId, "CustomerDynamic", customerId, isRLSRequired); |
Best Regards
Hi @JinHe ,
Base on your description, it seems like you got stuck when generating an embed token with RLS. Could you please check the following info?
Create separate methods for generating tokens for reports with RLS
public GenerateTokenRequestV2 CreateTokenRequest(string datasetId, Guid reportId, Guid workspaceId, string rlsRole, string customerId, bool isRLSRequired) var tokenRequest = new GenerateTokenRequestV2( return tokenRequest; var tokenRequest = CreateTokenRequest(datasetId, report.Id, workspaceId, "CustomerDynamic", customerId, isRLSRequired); |
Best Regards
@v-yiruan-msft
Thanks for you reply. This is how I solved this problem yesterday, in order to solve the token generation of all reports.
var tokenRequest = new GenerateTokenRequestV2(
reports: new List<GenerateTokenRequestV2Report>() { new GenerateTokenRequestV2Report(report.Id) },
datasets: new List<GenerateTokenRequestV2Dataset> { new GenerateTokenRequestV2Dataset(datasetId.ToString()) },
targetWorkspaces: workspaceId != Guid.Empty ? new List<GenerateTokenRequestV2TargetWorkspace>() { new GenerateTokenRequestV2TargetWorkspace(workspaceId) } : null,
identities: isPublic ? new List<EffectiveIdentity> { rlsIdentity } : null
);
var embedToken = await pbiClient.EmbedToken.GenerateTokenAsync(tokenRequest);
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
8 | |
3 | |
2 | |
2 | |
2 |