Nir Elbaz
Nir Elbaz

Reputation: 616

Delete a user from azure active directory with Python

I have a task to delete a user/update user attributes in the azure active directory using Python.

I searched and couldn't find any solution to do it.

Upvotes: 1

Views: 680

Answers (1)

Joy Wang
Joy Wang

Reputation: 42063

To delete the user and update user attributes, you could call the Microsoft Graph API in python.

1.Delete a user

DELETE https://graph.microsoft.com/v1.0/users/{user-id}

2.Update user

PATCH https://graph.microsoft.com/v1.0/me
Content-type: application/json

{
  "businessPhones": [
    "businessPhones-value"
  ],
  "officeLocation": "city-value"
}

To call Microsoft Graph in python, just refer to this link, sample code here.

Upvotes: 1

Related Questions