Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateJoin 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.
The code snippet below works fine for a Generic Report which means with Internal Dataset, however If I try to GenerateToken for a Report with an External Dataset meaning a Dataset that lives in another Workspace it throws a 403 Forbidden.
Note: I'm using SPN to authenticate my request and SPN is an Admin of Both Workspace (Workspace where the External Dataset Lives and Workspace where the Report lives)
using (var pbiClient = await this.GetClientAsync().ConfigureAwait(false))
{
if (pbiClient != null)
{
var dataset = await pbiClient.Datasets.GetDatasetByIdInGroupAsync(groupId, datasetId).ConfigureAwait(false);
GenerateTokenRequest genereateTokenRequestParameters;
var identity = new EffectiveIdentity(user.Username.Trim(), new List<string> { dataset.Id })
{
Roles = new List<string> { securityRole }
};
genereateTokenRequestParameters = new GenerateTokenRequest(accessLevel: "view", identity: identity);
// THIS LINE OF CODE RETURNS 403 FOR REPORT WITH EXTERNAL DATASET,
// WHILE WORKS IF REPORT AND DATASET IS IN THE SAME WORKSPACE
var tokenResponse = await pbiClient.Reports.GenerateTokenInGroupAsync(reportGroupId, report.Id, genereateTokenRequestParameters).ConfigureAwait(false);
embedReport.EmbedToken = tokenResponse ?? throw new NullReferenceException($"Power BI token not generated. Report ID: {report.Id}");
embedReport.EmbedUrl = report.EmbedUrl;
embedReport.ReportId = report.Id;
return embedReport;
}
}
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
8 | |
7 | |
2 | |
2 | |
2 |
User | Count |
---|---|
6 | |
5 | |
4 | |
4 | |
4 |