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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
AUaero
Responsive Resident
Responsive Resident

Office 365 groups vs Power BI workspaces

Hi,
I'm using the Invoke-PowerBIRestMethod cmdlet in Powershell to enumurate the reports in a given workspace.  First, I'm getting the workspaces using the Get-PowerBIWorkspace cmdlet and storing that in a variable:

 

# get a list of all the workspaces in the tenant
$workspaces = Get-PowerBIWorkspace -Scope Organization -All -Filter "tolower(type) eq 'group'"

 

Then I'm looping through each workspace to enumerate the reports.

 

# get a list of all reports in the tenant
$reports = foreach ($workspace in $workspaces)
{
    if($workspace.State = "Active") 
    {
        $URL = "https://api.powerbi.com/v1.0/myorg/groups/" + $workspace.Id + "/reports"
        $reports = Invoke-PowerBIRestMethod -Url $URL -Method GET
    }
}

 

The problem I'm running into is that the Get-PowerBIWorkspaces returns all workspaces in the tenant, including all the automatically created Office 365 groups.  When I pass the workspace ID for one of the O365 groups to the Power BI API to get the reports, I get an error.

Is there any way to programatically filter the workspaces to return *only* actual Power BI workspaces and exclude the O365 groups?

Thanks!

 

1 REPLY 1
Greg_Deckler
Community Champion
Community Champion

Perhaps use a try/catch block?


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.