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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
rafal_walisko
Helper I
Helper I

Migrating workspaces and reports between two tenants.

My task is to migrate quite a large number of workspaces and reports from the old tenant to the new one.

Is there any option to automate this task? I have already installed Powerbi cmdlets and used this https://powerbi.microsoft.com/en-us/blog/duplicating-workspaces-by-using-power-bi-cmdlets/ for copying reports from workspace to workspace on the same tenant, is there any way to use this for migration between tenants?

1 ACCEPTED SOLUTION

Ammm no. But if you read the doc of the library it shows how to login, get token and use the rest api categories (in this case reports and imports).

You should create two tokens, one for each tenant. Then create object reports to export it from a token from tenant 1. Create the second object imports to publish it from token from tenant 2.

Inside those objects there are two requests to use in order to get this:

 

# Get a json response from the API
response_with_pbix = export_report_in_group(workspace_id_origin, report_id)
# The response has a "Content" attribute with the pbix file. You can use that to import in the new tenant
simple_import_pbix_as_parameter(workspace_id, fileContent, datasetDisplayName)

 

 I hope that helps you understand the idea, it can also be done with requests that specify the local folder to save the file from tenant 1 and the local folder to import the file to tenant 2.


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

Happy to help!

LaDataWeb Blog

View solution in original post

3 REPLIES 3
ibarrau
Super User
Super User

Hi there. I'm not sure you can do it with cmdlets, but for sure you can with the PowerBi Rest API. I have used SimplePBI (Python lib) for exporting reports with less than 1gb on a variable and publish them back again to another tenant. You can also export them in the local environment and import them to the new tenant.

You can check it here: https://pypi.org/project/SimplePBI/

API Doc: https://learn.microsoft.com/en-us/rest/api/power-bi/

I hope that helps,

 


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

Happy to help!

LaDataWeb Blog

Great, do you have some example code where you exported reports to a variable and published them again?

Ammm no. But if you read the doc of the library it shows how to login, get token and use the rest api categories (in this case reports and imports).

You should create two tokens, one for each tenant. Then create object reports to export it from a token from tenant 1. Create the second object imports to publish it from token from tenant 2.

Inside those objects there are two requests to use in order to get this:

 

# Get a json response from the API
response_with_pbix = export_report_in_group(workspace_id_origin, report_id)
# The response has a "Content" attribute with the pbix file. You can use that to import in the new tenant
simple_import_pbix_as_parameter(workspace_id, fileContent, datasetDisplayName)

 

 I hope that helps you understand the idea, it can also be done with requests that specify the local folder to save the file from tenant 1 and the local folder to import the file to tenant 2.


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

Happy to help!

LaDataWeb Blog

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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