The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi,
I'm migrating client-code from ADAL.NET to MSAL.NET that embeds Power BI report, and what was working under ADAL.Net is failing in MSAL.Net approach. I'm unable to get the access token to a report with effective identity though I'm passing all parameters correctly. The error message 400 bad request with error is very misleading. I cannot find the reason this fails while ADAL.Net code with same parameters still works. I'm passing the SP's object id correctly as in ADAL.Net, but it fails.
Any idea what i'm doing wrong, kindly help.
public static async Task<EmbedToken> GetEmbedToken4(Guid workspaceId, Guid reportId, string accessLevel = "view")
{
using (var pbiClient = await GetPowerBiClient())
{
var pbiReport = pbiClient.Reports.GetReportInGroup(workspaceId, reportId);
string dataSet = pbiReport.DatasetId.ToString();
// Generate token request for RDL Report
var generateTokenRequestParameters = new GenerateTokenRequest(
accessLevel: accessLevel,
datasetId: dataSet,
identities: new List<EffectiveIdentity> { new EffectiveIdentity(username: "XyZ", roles: new List<string> { "010dd4a9-a250-4968-979e-4e7bf5b65ba7" })
});
// Generate Embed token
var embedToken = pbiClient.Reports.GenerateTokenInGroup(workspaceId, reportId, generateTokenRequestParameters);
return embedToken;
}
}
Solved! Go to Solution.
Anyone facing this issue, the error message is actually correct.
While passing EffectiveIdentity, you also need to pass the dataset id in the ei list as datasets:, i was missing that.
Hope this helps.
-skbg
Anyone facing this issue, the error message is actually correct.
While passing EffectiveIdentity, you also need to pass the dataset id in the ei list as datasets:, i was missing that.
Hope this helps.
-skbg
Hi @skbg ,
Whether your problem has been resolved? If yes, could you please mark your post as Answered? It will help the others in the community find the solution easily if they face the same problem as yours. Thank you.
Best Regards
User | Count |
---|---|
5 | |
3 | |
2 | |
2 | |
2 |
User | Count |
---|---|
11 | |
7 | |
5 | |
4 | |
4 |