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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Anonymous
Not applicable

Get PBIX files as admin

Hello,
I'm trying to use a powershell script to fetch all workspaces using:

 

 

Invoke-PowerBIRestMethod -Url "/admin/groups?%24top=3000" -Method Get | ConvertFrom-Json

 

 

Then checking for each group received for reports inside, using:

 

 

Invoke-PowerBiRestMethod -url ("admin/groups/" + $group.id + "/reports") -method get | ConvertFrom-Json

 

 

I was then unable to find a method to retrieve the pbix files using the API, so I resorted to:

 

 

Export-PowerBiReport -ID $report.id -OutFile ($v_pbixfilepath + $group.name + "\" + $report.name + ".pbix")

 

 

Which just then leads me to this error:

 

 

Export-PowerBiReport : Operation returned an invalid status code 'NotFound'

 

 

 

This may be because my user, a global admin, is not introduced in the workspaces where the reports are. However, I've tried to use an automatic way to add the user by the Add-UserAsAdmin method, but I get a 400 Bad Request. This can be due to my payload, but some workspaces work.

I'm stumped and I'd like to know if I'm approaching this correctly or there's no way of doing this through the API and should do it manually/other way instead. Thank you.

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Couldn't get the files through admin, however using this API call (which I missed) allowed me to get the reports within that workspace. However, the user needs to be in the workspace.

 

https://docs.microsoft.com/en-us/rest/api/power-bi/reports/exportreportingroup

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Couldn't get the files through admin, however using this API call (which I missed) allowed me to get the reports within that workspace. However, the user needs to be in the workspace.

 

https://docs.microsoft.com/en-us/rest/api/power-bi/reports/exportreportingroup

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.