Not able to disable user account using accountEnabled=false

Ridhima Bhalerao 1 Reputation point


I am trying to use the 'update' Graph API to disable user's account. This is the REST API I am using:[@](/users/na/?userId=990f8a56-0000-0006-0000-000000000000).com

Request Body:

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!

Azure Active Directory
Azure Active Directory
An Azure enterprise identity service that provides single sign-on and multi-factor authentication.
16,676 questions
{count} votes

5 answers

Sort by: Most helpful
  1. Carlos Castro Moreno 6 Reputation points

    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

    1 person found this answer helpful.

  2. JamesTran-MSFT 32,846 Reputation points Microsoft Employee

    @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

    Request Body - {"accountEnabled":"false"}  

    Once the command returned the appropriate response. I checked to make sure the account was actually disabled.



    Please let me know if you have any questions.
    Thank you for your time and patience throughout this issue!

  3. Bhanot Ravi 31 Reputation points

    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.


  4. Bhanot Ravi 31 Reputation points

    Thanks Ridhima for detailed answer. I would suggest let's wait for response from James as he is checking from Engineering team.


    0 comments No comments

  5. Bhanot Ravi 31 Reputation points

    HI Ridhima,

    Could you please confirm if there is any progress.


    0 comments No comments