Hello,
I am developing an application and am trying to embed Power Bi Premium, I have registeered the app as a Native Application, and used the ClientId to get the proper token. I have confirmed that I can get the report EmbedConfig info I need to embed the report, including a ReportId, a EmbedUrl, accessToken, ect....
However, when I call the furntion to embed it seems to try to load for a minute, but then just says content isn't available. The lines of code I am using to embed the report are....
var $reportContainer = $("#reportEmbed");
var report = powerbi.embed($reportContainer.get(0), self.embedConfig);
where....
embedConfig = {
accessToken: config.EmbedToken.token,
id: config.Id,
embedUrl: config.EmbedUrl
}
What I see in the debugging console is...
GET https://wabi-west-us-redirect.analysis.windows.net/metadata/cluster 403 (Forbidden)
wabi-west-us-redirect.analysis.windows.net/metadata/cluster:1
I am now stumped on how to proceed to make my report show up. Everything I find online about this is in regaurds to the old Power BI Embeded and not the new Premium option. If anyone can help me understand what I am doing wrong, so that I can get reports to show up correctly, I would be much obliged.
Thanks,
Steven
Solved! Go to Solution.
Thank you for your response. I was able to get this figured out this mornig. It seems I was just missing a few properties of the config that you pass to the powerbi.embed function. Now my config looks like.....
@Anonymous
Well, I don't see Embed token mentioned in your post, so guess that you may embed with the access token? The Embed token is generated specifically for individual reports/dashboards/tile with the accesstoken(See GenerateToken). You can get the GenerateToken by calling the REST API or with Power BI API.
var tokenCredentials = new TokenCredentials(authenticationResult.AccessToken, "Bearer"); // Create a Power BI Client object. It will be used to call Power BI APIs. using (var client = new PowerBIClient(new Uri(ApiUrl), tokenCredentials)) { // Get a list of reports. var reports = await client.Reports.GetReportsInGroupAsync(GroupId); // Get the first report in the group. var report = reports.Value.FirstOrDefault(); if (report == null) { return View(new EmbedConfig() { ErrorMessage = "Group has no reports." }); } // Generate Embed Token. var generateTokenRequestParameters = new GenerateTokenRequest(accessLevel: "view"); var tokenResponse = await client.Reports.GenerateTokenInGroupAsync(GroupId, report.Id, generateTokenRequestParameters); if (tokenResponse == null) { return View(new EmbedConfig() { ErrorMessage = "Failed to generate embed token." }); } // Generate Embed Configuration. var embedConfig = new EmbedConfig() { EmbedToken = tokenResponse, EmbedUrl = report.EmbedUrl, Id = report.Id }; return View(embedConfig); }
The embed token is a string starting with "H4sIAAAAAAAEA ....". A static html demo attached for your reference.
Thank you for your response. I was able to get this figured out this mornig. It seems I was just missing a few properties of the config that you pass to the powerbi.embed function. Now my config looks like.....
User | Count |
---|---|
16 | |
12 | |
2 | |
2 | |
2 |