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.

Reply
CorradoPag
Frequent Visitor

Error 'API is not accessible for application' when I run API GetAppUsersAsAdmin on Postman

Hi, I'm trying to run the GetAppUsersAsAdmin API on Postman.
I registered an app giving the authorization "Tenant.Read.All", but in the status appears the message: "not granted for ...", in the column "Admin consent required" has the value "No".
I get the application token from "://login.microsoftonline.com/tenant_id/oauth2/v2.0/token" with the user who has the roles: "Administrator Power Platform" and "Administrator of Power BI"
When I launch GET "://api.powerbi.com/v1.0/myorg/admin/apps/app_Id/users" from Postman I get the error "API is not accessible for application"
Can someone help me? Thank you. 

1 ACCEPTED SOLUTION
CorradoPag
Frequent Visitor

I solved it, I enabled the option "Allow service principals to use read-only admin APIs" in the menu Settings -> Admin Portal

CorradoPag_0-1660118778472.png

 

View solution in original post

8 REPLIES 8
CorradoPag
Frequent Visitor

I solved it, I enabled the option "Allow service principals to use read-only admin APIs" in the menu Settings -> Admin Portal

CorradoPag_0-1660118778472.png

 

CorradoPag
Frequent Visitor

Hi @v-yiruan-msft , thanks for the support. I still have the problem

In Postman I get the relative token

CorradoPag_3-1654074795818.png

 

and I use the token in the API PBI call, the appID I get it from the Power BI app URL, this URL is an example.

CorradoPag_1-1654073695985.png

 

CorradoPag_6-1654075474733.png

 

The two APIs need the admin grant, maybe that's the problem?

CorradoPag_0-1654073633721.png

 

There are no Power BI admin-consent-required permissions set on this application

CorradoPag_2-1654074304629.png

Hi @CorradoPag  ,

Whether your problem has been resolved? If yes, could you please mark the helpful post as Answered? It will help the others in the community find the solution easily if they face the same problem as yours. Thank you.

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-yiruan-msft, they gave me the rights for the two scopes

 

CorradoPag_0-1654695576253.png

 

but the error still appears

CorradoPag_1-1654695717019.png

 

Hi @CorradoPag ,

Yes, exactly. From the screenshot you provided, it looks like the required scope (Tenant.Read.All or Tenant.ReadWrite.Allto run that Admin REST API is not being met.

yingyinr_1-1654076481002.png

You can try to see if the desired result is returned after giving the appropriate permissions by referring to the documentation below.

Modifying Permissions of an Existing App Registration

yingyinr_0-1654076432351.png

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-yiruan-msft
Community Support
Community Support

Hi @CorradoPag ,

Whether your problem has been resolved? If yes, could you please mark the helpful post as Answered? It will help the others in the community find the solution easily if they face the same problem as yours. Thank you.

Otherwise,  you can follow the below steps to get it. 

1. Sign in Power BI Service with Power BI Admin account

2. Click "F12" and navigate to "Network" tab to get the token

yingyinr_0-1654069362271.png

3. Call the REST API GetAppUsersAsAdmin by Postman

yingyinr_1-1654069558797.png

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

worked for me ! thanks so much

v-yiruan-msft
Community Support
Community Support

Hi @CorradoPag ,

According to your description, it seems that the permission and scope are OK (Power BI Admin and has Tenant.Read.All permissions). Could you please tell me how you get the value of the parameter {appId} mentioned there? Can you provide a screenshot of the steps involved? Thank you.

yingyinr_2-1653900729789.png

Also, please check the documentation below, I hope it will help you to solve the problem.

Power BI - On Cloud

Important:  Make sure there are no Power BI admin-consent-required permissions set on this application. For more information, see Managing consent to applications and evaluating consent requests.


Grant tenant-wide admin consent to an application

yingyinr_1-1653900631599.png

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.