AlexSC
AlexSC

Reputation: 1923

How to update a Azure AD user?

I have successfully created a new user in Azure AD following Create User reference.

Now I want to update that very same user following Update User reference. To keep things simple This is the JSon content I'm sending:

{
    "userType": "T"
}

The documentation tells me to send a PATCH request, but I always receive an HTTP Error 400 (Bad request). If I try sending a POST request I receive an HTTP Error 405 (Method not allowed).

The destination URL is https://graph.microsoft.com/v1.0/users/user-id. The user-id is the one returned with the user details.

What am I missing?

Update 1

Those are the permissions set to the application: enter image description here

Upvotes: 0

Views: 185

Answers (1)

astaykov
astaykov

Reputation: 30903

This is exactly how you update user (PATCH).

However the userType property cannot be T, from the docs you refer:

enter image description here

That property can only have one of the two distinct values: Member or Guest.

Of course, the user-id in path should the id property as returned by the get users operation.

I am pretty sure that if you use a normal REST client will be able to see the whole error message, which will be more meaningful.

If you still have issue - paste the exact error message.

Upvotes: 1

Related Questions