Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
using (var client = new PowerBIClient(new Uri(API_URL), new TokenCredentials(accessToken, "Bearer")))
{
Report powerBiReport = await client.Reports.GetReportInGroupAsync(groupId, reportId.ToString());
#region default
var generateTokenRequestParameters = new GenerateTokenRequest("view", null, identities: new List<EffectiveIdentity> { new EffectiveIdentity(username: username, roles: roles, datasets: new List<string> { powerBiReport.DatasetId }) });
var token = await client.Reports.GenerateTokenInGroupAsync(groupId, reportId, generateTokenRequestParameters);
}
it works fine without effectiveidentity ut it fails with effective identity. Please help in identifying the parameters
Solved! Go to Solution.
Hi @Sanjana ,
What do you mean by fails , do you get any error ? pls share that.
if (datasets.IsEffectiveIdentityRolesRequired == true) { if (!string.IsNullOrWhiteSpace(username)) { var rls = new EffectiveIdentity { Username = username, Roles = new List<string> { roles }, Datasets = new List<string> { report.DatasetId } }; if (!string.IsNullOrWhiteSpace(roles)) { var rolesList = new List<string>(); rolesList.AddRange(roles.Split(',')); rls.Roles = rolesList; } // Generate Embed Token with effective identities. generateTokenRequestParameters = new GenerateTokenRequest(accessLevel: "view", identities: new List<EffectiveIdentity> { rls }); } }
Try the above code which having more condition for you to check
Hi @Sanjana ,
What do you mean by fails , do you get any error ? pls share that.
if (datasets.IsEffectiveIdentityRolesRequired == true) { if (!string.IsNullOrWhiteSpace(username)) { var rls = new EffectiveIdentity { Username = username, Roles = new List<string> { roles }, Datasets = new List<string> { report.DatasetId } }; if (!string.IsNullOrWhiteSpace(roles)) { var rolesList = new List<string>(); rolesList.AddRange(roles.Split(',')); rls.Roles = rolesList; } // Generate Embed Token with effective identities. generateTokenRequestParameters = new GenerateTokenRequest(accessLevel: "view", identities: new List<EffectiveIdentity> { rls }); } }
Try the above code which having more condition for you to check
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
11 | |
6 | |
4 | |
2 | |
2 |
User | Count |
---|---|
4 | |
3 | |
3 | |
3 | |
3 |