cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

AuthorizationFailed when trying to use Capacities-Suspend API endpoint

Hey guys. I'm new to PBI (2 days in!) and I need some help using the API to suspend my PBI Embedded A1 Capacity. I want to do this as a back-end function from a web server (no user interaction). I've been testing the POSTs below with Postman....

 

When I do a POST to Suspend Capacity with this URL...

https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBIDedicated/capacities/{dedicatedCapacityName}/suspend?api-version=2017-10-01
... I get this error message:
"error""invalid_grant",
"error_description""AADSTS65001: The user or administrator has not consented to use the application with ID 'bla bla bla bla'.... Send an interactive authorization request for this user and resource".
 
I got that error message when I used the Access Token I got from POSTing to:
https://login.microsoftonline.com/common/oauth2/token with grant_type = password.  I used the username and password of the Global Admin.
 
I then tried getting the Access Token, by POSTing to:
https://login.microsoftonline.com/{tenant ID}/oauth2/token with grant_type = client_credentials. I used the Client Secret of my (only) registered app.
 
This time, the POST to Suspend Capacity returned this error message:
 "error": {
"code": "AuthorizationFailed",
"message": "The client '80d81297-xxxxxxxxxxx' with object id '80d81297-xxxxxxxxxxx' does not have authorization to perform action 'Microsoft.PowerBIDedicated/capacities/suspend/action' over scope '/subscriptions/3ae6d438-3b19-41ee-acf6-9c4cec5c33ce/resourceGroups/CIOPulse/providers/Microsoft.PowerBIDedicated/capacities/ciopulsepowerbi' or the scope is invalid. If access was recently granted, please refresh your credentials."
}
(I have no idea what that object id is in the error message. I don't recognise it at all).
 
What do I need to do here?  As you can tell, I have no idea what I'm doing and I'm just mucking around trying stuff. So any help would be much appreciated. Cheers!
1 ACCEPTED SOLUTION

Accepted Solutions
Helper I
Helper I

Re: AuthorizationFailed when trying to use Capacities-Suspend API endpoint

OK, I solved this by:

- Going into my Power BI Embedded Capacity.

- Clicking Access control (IAM).

- Assigning the Role, 'Owner', to my registered application.

 

If there's a better way, please let me know.

View solution in original post

1 REPLY 1
Helper I
Helper I

Re: AuthorizationFailed when trying to use Capacities-Suspend API endpoint

OK, I solved this by:

- Going into my Power BI Embedded Capacity.

- Clicking Access control (IAM).

- Assigning the Role, 'Owner', to my registered application.

 

If there's a better way, please let me know.

View solution in original post

Helpful resources

Announcements
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Upcoming Events

Upcoming Events

Wondering what events you could join or have an event to promote yourself? Check out our Upcoming Events.

Community Summit Australia – Join Online!

Community Summit Australia – Join Online!

Be a part of the leading Microsoft Business Applications digital event, curated for the APAC community.