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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

0

GetGroupsAsAdmin and GetAppsAsAdmin returning 400 (bad request)

I've been getting a bad request calls to some of the admin APIs (GetGroupsAsAdmin, GetAppsAsAdmin), despite making calls in line with what the documentation (https://learn.microsoft.com/en-us/rest/api/power-bi/admin/groups-get-groups-as-admin) says.

 

I'm connected as a Power BI Service Admin, and can make calls successfully to other admin APIs (e.g. dataflows and datasets), so I don't believe this is a permissions issue. We have all API tenant settings enabled. We are working with a pro licence.

 

I'm not getting any more information than just the 400 code in response - is there anything broken about these particular APIs?

 

Connect-PowerBIServiceAccount
Invoke-PowerBIRestMethod -Method Get -Url "https://api.powerbi.com/v1.0/myorg/admin/groups?$top=10"
$Error[$Error.Count - 1].Exception.InnerException

 

JoshT_0-1668782116342.png

 

EDIT: I've also tried this with parameters and arguments ripped straight from the docs and got a 404 error:

https://api.powerbi.com/v1.0/myorg/admin/groups?$expand=users&$top=100

JoshT_0-1668788650055.png

 

Status: Delivered

Hi @JoshT 

I am so glad to hear that your issue has been fixed . Thanks for your sharing . I will change the status to "Delivered" .

 

Best Regards,
Community Support Team _ Ailsa Tao

Comments
v-yetao1-msft
Community Support
Status changed to: Investigating

Hi @JoshT 

I tested with top=10 and get the result normally . Does your Required Scope meet the requirements ? If you change the top to 10 or less, can you get a correct value ?

Ailsamsft_0-1669009506785.png

Ailsamsft_1-1669009606474.png

Best Regards,
Community Support Team _ Ailsa Tao

JoshT
Advocate II

Thanks for your reply @v-yetao1-msft. As stated above, I'm connecting as my Power BI Service Admin account, and am able to successfully run e.g. the GetDatasetsAsAdmin API (which requires the same scope).

 

I've tried with several different numbers in the $top parameter and also tried examples ripped straight from the documentation and can't get a success response at all from this or the GetAppsAsAdmin API. Unfortunately we need this to use the scanner APIs so this is a blocker as it stands.

v-yetao1-msft
Community Support

Hi @JoshT 

Based on the above information, if you are a Power BI Pro licensee, you can create a support ticket for free and a dedicated Microsoft engineer will come to solve the problem for you.

It would be great if you continue to share in this issue to help others with similar problems after you know the root cause or solution.

The link of Power BI Support: https://powerbi.microsoft.com/en-us/support/

For how to create a support ticket, please refer to https://community.powerbi.com/t5/Community-Blog/How-to-create-a-support-ticket-in-Power-BI/ba-p/6830...

 

Best Regards,
Community Support Team _ Ailsa Tao

JoshT
Advocate II

Thanks @v-yetao1-msft . Support found that the top parameter wasn't being sent - the dollar sign required for the parameter name meant PowerShell was pulling in a session variable that didn't exist (so the uri would have been "https://api.powerbi.com/v1.0/myorg/admin/groups?=10" ).

 

The correct syntax is as below:

 

 

Invoke-PowerBIRestMethod -Method Get -Url "https://api.powerbi.com/v1.0/myorg/admin/groups?`$top=10"

 

 

I guess that's the problem with using the PowerShell ISE, string and variable are highlighted in only slightly different shades of brown!

v-yetao1-msft
Community Support
Status changed to: Delivered

Hi @JoshT 

I am so glad to hear that your issue has been fixed . Thanks for your sharing . I will change the status to "Delivered" .

 

Best Regards,
Community Support Team _ Ailsa Tao