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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
olegkazanskyi
Helper II
Helper II

PowerBI REST API filter request GetGroupsAsAdmin returns AggregateException. PowerShell

I am retrieving data from Power BI Rest API following the instruction here:
https://learn.microsoft.com/en-us/rest/api/power-bi/admin/groups-get-groups-as-admin#grouptype

A call to retrieve all data works ok. Here is the URL that works:

$url = "https://api.powerbi.com/v1.0/myorg/admin/groups?%24top="+$number_of_records+"&%24expand=dataflows,datasets,reports,dashboards,workbooks,users"

But this request return too much data that I want to filter it.

In particular, I don't want to see personal workspaces.
But my calls return an AggregateException error.
Here are the URLs I tried that conform with the MSDocs but do not work:

Here I tried to filter out all "PersonalGroup" type

$url1 = "https://api.powerbi.com/v1.0/myorg/admin/groups?%24top=" + $number_of_records + '&%24filter=type ne' + " 'PersonalGroup'" + '&%24expand=dataflows,dashboards,reports,datasets,users'



And here, I tried to keep everything except "PersonalGroup" type.

$url2 = "https://api.powerbi.com/v1.0/myorg/admin/groups?%24top=" + $number_of_records + '&%24filter=type eq' + " 'Group'" + ' or type eq' + " 'Personal'" + ' or type eq' + " 'Workspace'" + '&%24expand=dataflows,dashboards,reports,datasets,users'

Both throw the same error:

Invoke-PowerBIRestMethod : One or more errors occurred.
At line:1 char:15
+ $Result = Invoke-PowerBIRestMethod -Url $url -Method GET
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (Microsoft.Power...werBIRestMethod:InvokePowerBIRestMethod) [Invoke-PowerBIRestMethod], AggregateException
+ FullyQualifiedErrorId : One or more errors occurred.,Microsoft.PowerBI.Commands.Profile.InvokePowerBIRestMethod

Does anyone know how is this fixable I can't find an answer online and I don't see any errors in my request

0 REPLIES 0

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.