How to deactivate and reactivate user in Azure AD

2019-07-31 17:16发布

问题:

Is there any way to deactivate and reactivate Azure AD B2C user. I want to implement functionality which toggles Azure AD user status.

回答1:

If by "deactivate and reactivate" you mean prevent the user from signing in. This is currently only possible for local accounts (not accounts from social providers: Facebook, Google, etc).

You can achieve this by either:

  1. The Azure portal, Users and Groups blade > Profile > Settings, Block sign in.

  2. The Microsoft Graph, by sending a PATCH request to the beta/users/ and setting the 'accountEnabled' property to false. More info here: https://graph.microsoft.io/en-us/docs/api-reference/beta/api/user_update

If you'd like to be able to disable sign-in for social accounts as well, I'd recommend you create an entry in the Azure AD B2C UserVoice forum requesting this feature:

https://feedback.azure.com/forums/169401-azure-active-directory/category/160596-b2c