We get an error in powershell with "invoke-RestMethod" on "https://api.powerbi.com/v1.0/myorg/admin/groups."
$groups = Invoke-RestMethod -Uri $urigroups –Headers $authHeader –Method GET –Verbose
VERBOSE: GET https://api.powerbi.com/v1.0/myorg/admin/groups with 0-byte payload
Invoke-RestMethod : The remote server returned an error: (400) Bad Request.
At line:2 char:11
+ $groups = Invoke-RestMethod -Uri $urigroups –Headers $authHeader –Method GET –Ve ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
On "https://api.powerbi.com/v1.0/myorg/admin/datasets" we do not receive an error:
VERBOSE: GET https://api.powerbi.com/v1.0/myorg/admin/datasets with 0-byte payload
VERBOSE: received -1-byte response of content type application/json; odata.metadata=minimal; odata.streaming=true
9 Comments
- v-jiascu-msftMicrosoft Employee
Hi Hamer57 ,
I have reported this issue to the Product Team. There could be a workaround for now.
Add the $top parameter to the URL: https://api.powerbi.com/v1.0/myorg/admin/groups?$top=3000

Best Regards,
Dale
- Hamer57New Member
Hi Dale,
Thanks.
Still getting error 400 when using Invoke-RestMethod.
What worked for me:
Best Regards,
Remko
- v-jiascu-msftMicrosoft Employee
Hi Remko,
Thanks for sharing. Update: the report No. : CRI 105642036.
BTW, if you have a large number of App workspaces. The max number could be 5000.
Best Regards,
Dale
- v-jiascu-msftMicrosoft EmployeeStatus changed:NewtoAccepted
- v-jiascu-msftMicrosoft Employee
Hi Hamer57 ,
I got the responses from the Product Team. They will update the documentation. The $top parameter is mandatory for better performance. If you have more than 5000 App workspaces, you can get them by calling the API more than once.
Best Regards,
Dale
- v-jiascu-msftMicrosoft EmployeeStatus changed:AcceptedtoDone
- AnonymousNot applicable
Hi,
This issue is still happening. Any news?{"error":{"code":"InvalidRequest","message":"This API expects $top query option to be provided."}}Is the Top mandatory? According to the documentation it should not be needed. - ksabiAdvocate II
Hi,
I'm getting the same error with PowerShell:
https://api.powerbi.com/v1.0/myorg/admin/groups?$top=100
Do you have any news?
Best Regards,
ksabi
- ksabiAdvocate II
Anonymous If you still have the issue,
I tried this url and it works for me. https://api.powerbi.com/v1.0/myorg/admin/groups?%24top=100
It appears that the $ is not read correctly.
Best Regards,
ksabi