Hi RidhimaBhalerao-8704,
Could you check if the user you want to disable has a role assigned to him?
In my case I can only change it to users who do not have any role assigned
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello,
I am trying to use the 'update' Graph API to disable user's account. This is the REST API I am using:
Request Body:
{
"accountEnabled":"false"
}
Unfortunately I get the following response:
"code": "Authorization_RequestDenied",
"message": "Insufficient privileges to complete the operation."
I am using the client_id and client_secret to get the OAUTH token. Although, I can update any other field for the same user using the same API call.
Is there anything that I am missing? Any help is appreciated.
Thank you!
Hi RidhimaBhalerao-8704,
Could you check if the user you want to disable has a role assigned to him?
In my case I can only change it to users who do not have any role assigned
@Ridhima Bhalerao
Looking at your error message it looks like you might not have the correct permissions to disable the user's account. Are you trying to do this through Microsoft Graph Explorer?
I wasn't able to replicate your issue but will post my findings below: Using the Microsoft Graph API
Patch
https://graph.microsoft.com/v1.0/users/testuser1@.domain.onmicrosoft.com
Request Body - {"accountEnabled":"false"}
Once the command returned the appropriate response. I checked to make sure the account was actually disabled.
Get
https://graph.microsoft.com/v1.0/users/testuser1@.domain.onmicrosoft.com?$select=accountEnabled
Please let me know if you have any questions.
Thank you for your time and patience throughout this issue!
Hi RidhimaBhalerao-8704,
Can you verify if the user ID that you are using has got "User Administrator" role assigned, if not try giving this role to your ID and then try executing the command or Patch Query.
User Administrator role has access to manage all aspects of users and groups.
Thanks,
Ravi
Thanks Ridhima for detailed answer. I would suggest let's wait for response from James as he is checking from Engineering team.
Thanks,
Ravi
HI Ridhima,
Could you please confirm if there is any progress.
Thanks,
Ravi