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 dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hello everyone,
I'm actually trying to integrate PowerBi report into a Symfony application.
Now what I do is create a script to get an embedded Token:
public function __construct($azureKey, $workSpaceCollectionName, $workSpaceCollectionId, $reportId) { $this->key = $azureKey; $this->payload = [ 'ver' => '0.2.0', 'type' => 'embed', 'wcn' => $workSpaceCollectionName, 'wid' => $workSpaceCollectionId, 'rid' => $reportId, 'iss' => 'PowerBISDK', 'aud' => 'https://analysis.windows.net/powerbi/api', 'exp' => time() + 60 * 60, 'nbf' => time(), ]; } public function getToken() { return JWT::encode($this->payload, $this->key); }
Based on documentation:
https://docs.microsoft.com/en-us/azure/power-bi-embedded/power-bi-embedded-iframe
https://stackoverflow.com/questions/36694170/power-bi-embedded-from-php-obtain-an-azure-authenticati...
And then in the view is use this JS script:
<script> var accessToken = $('#accessToken').data('token'); var reportToken = $('#reportToken').data('token'); // Read embed URL from Model var embedUrl = "https://embedded.powerbi.com/appTokenReportEmbed?reportId=" + reportToken; var embedReportId = reportToken; var models = window['powerbi-client'].models; var config = { type: 'report', accessToken: accessToken, embedUrl: embedUrl, id: embedReportId, settings: { filterPaneEnabled: false, navContentPaneEnabled: false } }; // Get a reference to the embedded report HTML element var reportContainer = $('#reportContainer')[0]; // Embed the report and display it within the div container. var report = powerbi.embed(reportContainer, config); </script>
But actually the system return me :
GET https://wabi-us-east2-redirect.analysis.windows.net/metadata/cluster 403 (Forbidden)
The problem is porbably with the token and especially the AzureKey. As the powerBi is now deprecated in the AzurePortal, and or not accessible for new user, i can't access it. So I have created an application in azure active directory, and link powerBi in it, and setup correct permission.
Then i have generated a key for this application, and i'm using this key to generate access token. But as you can see is not working.
So don't really know what i'm doing wrong right now?
Does anyone have an idea?
Thx by advance.
Solved! Go to Solution.
@chares_has wrote:
AS I said, I can't access workspace collection, and anyway this method is deprecated and will be shutdown. So it doesn't make sense for our company. My question is, how we can have a proper key to embedded Microsoft Bi report in that case ?
Thx a lot
Getting access key in Azure portal is the only approach to get the proper "key" in that being deprecated Power BI Embedded. If you don't like it, you can consider the replacement Embedding with non-Power BI users (app owns data), just follow the tutorial. Note that in latter case, Premium license is required.
@chares_has wrote:
Hello everyone,
I'm actually trying to integrate PowerBi report into a Symfony application.
Now what I do is create a script to get an embedded Token:public function __construct($azureKey, $workSpaceCollectionName, $workSpaceCollectionId, $reportId) { $this->key = $azureKey; $this->payload = [ 'ver' => '0.2.0', 'type' => 'embed', 'wcn' => $workSpaceCollectionName, 'wid' => $workSpaceCollectionId, 'rid' => $reportId, 'iss' => 'PowerBISDK', 'aud' => 'https://analysis.windows.net/powerbi/api', 'exp' => time() + 60 * 60, 'nbf' => time(), ]; } public function getToken() { return JWT::encode($this->payload, $this->key); }
Based on documentation:
https://docs.microsoft.com/en-us/azure/power-bi-embedded/power-bi-embedded-iframe
https://stackoverflow.com/questions/36694170/power-bi-embedded-from-php-obtain-an-azure-authenticati...
And then in the view is use this JS script:<script> var accessToken = $('#accessToken').data('token'); var reportToken = $('#reportToken').data('token'); // Read embed URL from Model var embedUrl = "https://embedded.powerbi.com/appTokenReportEmbed?reportId=" + reportToken; var embedReportId = reportToken; var models = window['powerbi-client'].models; var config = { type: 'report', accessToken: accessToken, embedUrl: embedUrl, id: embedReportId, settings: { filterPaneEnabled: false, navContentPaneEnabled: false } }; // Get a reference to the embedded report HTML element var reportContainer = $('#reportContainer')[0]; // Embed the report and display it within the div container. var report = powerbi.embed(reportContainer, config); </script>
But actually the system return me :
GET https://wabi-us-east2-redirect.analysis.windows.net/metadata/cluster 403 (Forbidden)
The problem is porbably with the token and especially the AzureKey. As the powerBi is now deprecated in the AzurePortal, and or not accessible for new user, i can't access it. So I have created an application in azure active directory, and link powerBi in it, and setup correct permission.
Then i have generated a key for this application, and i'm using this key to generate access token. But as you can see is not working.
So don't really know what i'm doing wrong right now?
Does anyone have an idea?
Thx by advance.
The accesstoken for embedding has nothing to do with any Azure AD application. What is the "$this->key = $azureKey;" in your case? It shall be the accesskey of Power BI Workspace Collection, you can get it from Azure portal. The Power BI Workspace collection can't be created from Azure portal for new users, however if you already have an exsiting one, you can still access it.
AS I said, I can't access workspace collection, and anyway this method is deprecated and will be shutdown. So it doesn't make sense for our company. My question is, how we can have a proper key to embedded Microsoft Bi report in that case ?
Thx a lot
@chares_has wrote:
AS I said, I can't access workspace collection, and anyway this method is deprecated and will be shutdown. So it doesn't make sense for our company. My question is, how we can have a proper key to embedded Microsoft Bi report in that case ?
Thx a lot
Getting access key in Azure portal is the only approach to get the proper "key" in that being deprecated Power BI Embedded. If you don't like it, you can consider the replacement Embedding with non-Power BI users (app owns data), just follow the tutorial. Note that in latter case, Premium license is required.
User | Count |
---|---|
5 | |
4 | |
4 | |
2 | |
2 |
User | Count |
---|---|
8 | |
6 | |
4 | |
4 | |
4 |