Upravit

Sdílet prostřednictvím


Update authentication method states

Namespace: microsoft.graph

Important

APIs under the /beta version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.

Update the properties of a user's authentication method states. Use this API to update the following information:

This API is available in the following national cloud deployments.

Global service US Government L4 US Government L5 (DOD) China operated by 21Vianet

Permissions

Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.

Permissions to update system-preferred MFA

Permission type Least privileged permissions Higher privileged permissions
Delegated (work or school account) UserAuthenticationMethod.ReadWrite UserAuthenticationMethod.ReadWrite.All
Delegated (personal Microsoft account) Not supported. Not supported.
Application UserAuthenticationMethod.ReadWrite UserAuthenticationMethod.ReadWrite.All

Important

In delegated scenarios with work or school accounts where the signed-in user is acting on another user, they must be assigned a supported Microsoft Entra role or a custom role with a supported role permission. The following least privileged roles are supported for this operation.

  • Authentication Administrator
  • Privileged Authentication Administrator

Permissions to update per-user MFA state

Permissions acting on self

Permission type Least privileged permissions Higher privileged permissions
Delegated (work or school account) Policy.ReadWrite.AuthenticationMethod Not available.
Delegated (personal Microsoft account) Not supported. Not supported.
Application Not supported. Not supported.

Permissions acting on others

Permission type Least privileged permissions Higher privileged permissions
Delegated (work or school account) Policy.ReadWrite.AuthenticationMethod Not available.
Delegated (personal Microsoft account) Not supported. Not supported.
Application Policy.ReadWrite.AuthenticationMethod Not available.

Important

In delegated scenarios with work or school accounts, the signed-in user must be assigned a supported Microsoft Entra role or a custom role with a supported role permission. Authentication Policy Administrator is the least privileged role supported for this operation.

HTTP request

To update the sign-in preferences (system-preferred MFA) for a user:

PATCH /users/{id | userPrincipalName}/authentication/signInPreferences

To update the per-user multifactor authentication state for the signed-in user:

PATCH /me/authentication/requirements

To update the per-user multifactor authentication state for a user:

PATCH /users/{id | userPrincipalName}/authentication/requirements

Request headers

Name Description
Authorization Bearer {token}. Required. Learn more about authentication and authorization.
Content-Type application/json. Required.

Request body

In the request body, supply only the values for properties to update. Existing properties that aren't included in the request body maintain their previous values or are recalculated based on changes to other property values.

The following table specifies the properties that can be updated.

Property Type Description
isSystemPreferredAuthenticationMethodEnabled Boolean Indicates whether the credential preferences of the system are enabled.
userPreferredMethodForSecondaryAuthentication userDefaultAuthenticationMethodType The default second-factor method used by the user when signing in. If a user is enabled for system-preferred authentication, then this value is ignored except for a few scenarios where a user is authenticating via NPS extension or ADFS adapter. Possible values are push, oath, voiceMobile, voiceAlternateMobile, voiceOffice, sms, and unknownFutureValue
perUserMfaState perUserMfaState The user's state for per-user multifactor authentication. Possible values are enforced, enabled and disabled.

Response

If successful, this method returns a 204 No Content response code.

Examples

Example 1: Update a user's system-preferred MFA method

Request

The following example shows a request.

PATCH https://graph.microsoft.com/beta/users/071cc716-8147-4397-a5ba-b2105951cc0b/authentication/signInPreferences
Content-Type: application/json

{
  "userPreferredMethodForSecondaryAuthentication": "oath"
}

Response

HTTP/1.1 204 No Content

Example 2: Update a user's MFA state

Request

The following example shows a request.

PATCH https://graph.microsoft.com/beta/users/071cc716-8147-4397-a5ba-b2105951cc0b/authentication/requirements
Content-Type: application/json

{
  "perUserMfaState": "disabled"
}

Response

HTTP/1.1 204 No Content