A few weeks ago one of my colleagues showed me a PowerShell script to export all Power BI reports from a Power BI Workspace. This could come in handy for back-up purposes (version control is still hard to accomplish) or if you don’t have access to the PBIX files via the normal way and you need to do some edits. The original file can be found here.
I made some changes to the original file to download all reports, from all workspaces and put them in a nice folder structure, with the same names as your workspaces. Of course, it’s still possible to limit the download to only one workspace and one report. Here we go.
With the comments inside the script, I already explain step-by-step how it works. Now I just add some screenshots to show whats happening!
As you can see in the picture above, I decided to download all my reports, from all my workspaces. Some reports aren’t available for download, for example, when incremental refresh is enabled. So far I’ve encountered the following operation failures: Forbidden, BadRequest, NotFound and Unauthorized. The incremental refresh report gave me a BadRequest, and two Usage Metrics report, which I didn’t create, were NotFound. Makes sense, but I’m not sure how they got indexed in the first place. The Unauthorized one is a Microsoft 365 Usage Analytics report. That's an app from AppSource and while writing this article, you aren’t able to download these pbix files. Now the Forbidden one. I’ts a copy of an incremental refresh dataset, and has no data inside. I’m not completely sure how I got it there in the first place. But that there is something wrong with it, that's for sure ;).
Here you can see the results of the final step of the script:
And here is my folder structure. As you can see I ran it on the 29th of January and the first of February:
I really hope this script will come in handy for those who need it! With the different options to download All reports, from all workspaces or all reports in one workspace or one report in one workspace, you have a lot of freedom to adjust it to your needs!