Skip to main content
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Not applicable

Create Report in Embedded Power BI with GenerateTokenRequestV2


I have a powerBI embedded into a web application. The app contains a feature to create new reports as well that will save it into a workspace with the specified dataset.

The new experience workspaces came up with the dataset sharing capability, that'll enable users to create reports across multiple workspaces but using the dataset from one workspace. I've used the GenerateTokenRequestV2 to generate the embed token and used the Microsoft client library for JS PowerBI-Client to embed the same.

Am able to successfully embed and work on creating the report with the specified dataset, but there is an error thrown up on trying to save the report.
The network tab shows a call with endpoint "https://wabi-west.../explore/explorations?name={Report Name}" returning 403 status code.


Any help appreciated. Thanks in advance. 

Frequent Visitor

I am also experiencing this issue.  I am generating embed token using pbiClient.Reports.GenerateTokenForCreateInGroup(targetWorkspaceId, tokenRequestParams);  In the client, I call powerbi.createReport(embedContainer, embedCreateConfiguration); where embedCreateConfiguration includes groupId of target workspace.  In the generated report object, I can see the groupId and datasetId represented in the createConfig attributes.  The standard SaveAs dialog will successfully save the report; however:

I updated the embedCreateConfiguration settings to include: useCustomSaveAsDialog: true

I added event handler for the saveAsTriggered event.  I then set targetWorkspaceId as part of the saveAsParameters similar to documentation here.  However, calling the saveAs function does not succeed in saving the report.  That is when I get 403 error similar to above:


Using the error event handler I captured the error object:

  • detailedMessage: "Unable to save the report"
  • errorCode: undefined
  • level: 2
  • message: "ExplorationContainer_FailedToSaveReportDefaultDetails"

I would expect this to be effectively the same as the standard SaveAs dialog.  I can't find any information on the ExplorationContainer message.  The example SaveAs code is quite simple, so I'm wondering if this is a bug?


I am using:

  • Microsoft.PowerBI.API (3.28.1)
  • Microsoft.PowerBI.JavaScript (2.18.6)


The service principal has the required API permissions: Workspace.ReadWrite.All, Report.ReadWrite.All, Dataset.ReadWrite.All

And the fact that the standard dialog saves makes it seem like it is not a permission issue.


Any insight into how I can force the standard SaveAs dialog to use the target workspace or how I can get the custom dialog to work?

I was able to resolve the issue...


I changed my code to use the same “pbiClient.EmbedToken.GenerateToken” API call as view/edit rather than the “pbiClient.Reports.GenerateTokenForCreateInGroup” API call.  My understanding was that report creation required the more specific call for creating a report in a group.  However, it appears that it was the cause of the issue, and is still a v1 call.


Using the GenerateToken API instead did resolve the issue.  The custom SaveAs dialog now works and allows me to save to the target workspace.  I simply provide Guid.Empty for the reports portion of the GenerateTokenRequestV2 and include the Dataset and targetWorkspace.

Thanks for sharing the fix here. I am still having the same issue as your original issue.

In the UI code are you specifying the targetWorkspaceId on the SaveAs call (via the SaveAsTriggered event) or is it enough that your token request includes the target workspace?

@gotters I capture the targetWorkspaceId back out of the embedded object within the saveAsTriggered event:

report.on("saveAsTriggered", function (event) {
    var targetWorkspaceId = embeddedObject.targetWorkspaceId;

This is then passed with report name to my saveAs function that does the actual work.

Thanks for the help. I was trying that but my saveAsTriggered was not firing.
just figured out I need to add to config

  settings: {
    useCustomSaveAsDialog: true
Community Support
Community Support

Hi @Anonymous ,


You need to purchase Power BI Embedded. 


Best Regards,
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Not applicable

Hi @V-lianl-msft ,

The account is provisioned with PRO license but the workspace is under a dedicated premium capacity and the tenant runs under a Power BI Premium subscription.

Is the Power BI Embedded license still required?

Hi @Anonymous ,


Not required.

Refer to this article and check your settings and limitations to see if you can solve your issue. 

If your issue occurs frequently and you need additional help, you could have a support by creating a ticket in Power BI support.



Best Regards,
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.


Community Support
Community Support

Hi @Anonymous ,


What kind of license is your account?Pro?Free?Embeded? 


Best Regards,
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Not applicable

Hi @V-lianl-msft ,


The account is provisioned with Powe BI PRO license.


I tried creating the report in the similar way (with shared dataset) in the power BI web app directly and it worked fine, but facing the issue when doing it via embedded mode in our web application.


This is the config I send to the "powerbi-client" library.

      type: 'report',
      tokenType: 1,
      accessToken: '__access_token__',
      embedUrl '',
      datasetId: '__shared_datasetID__',
      groupId: '__target_workspaceID__',

Helpful resources

Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City


Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors