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:
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
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.
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:
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
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new SignInPreferences
{
UserPreferredMethodForSecondaryAuthentication = UserDefaultAuthenticationMethodType.Oath,
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Users["{user-id}"].Authentication.SignInPreferences.PatchAsync(requestBody);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewSignInPreferences()
userPreferredMethodForSecondaryAuthentication := graphmodels.OATH_USERDEFAULTAUTHENTICATIONMETHODTYPE
requestBody.SetUserPreferredMethodForSecondaryAuthentication(&userPreferredMethodForSecondaryAuthentication)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
signInPreferences, err := graphClient.Users().ByUserId("user-id").Authentication().SignInPreferences().Patch(context.Background(), requestBody, nil)
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
SignInPreferences signInPreferences = new SignInPreferences();
signInPreferences.setUserPreferredMethodForSecondaryAuthentication(UserDefaultAuthenticationMethodType.Oath);
SignInPreferences result = graphClient.users().byUserId("{user-id}").authentication().signInPreferences().patch(signInPreferences);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\SignInPreferences;
use Microsoft\Graph\Beta\Generated\Models\UserDefaultAuthenticationMethodType;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new SignInPreferences();
$requestBody->setUserPreferredMethodForSecondaryAuthentication(new UserDefaultAuthenticationMethodType('oath'));
$result = $graphServiceClient->users()->byUserId('user-id')->authentication()->signInPreferences()->patch($requestBody)->wait();
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.sign_in_preferences import SignInPreferences
from msgraph_beta.generated.models.user_default_authentication_method_type import UserDefaultAuthenticationMethodType
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = SignInPreferences(
user_preferred_method_for_secondary_authentication = UserDefaultAuthenticationMethodType.Oath,
)
result = await graph_client.users.by_user_id('user-id').authentication.sign_in_preferences.patch(request_body)
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new StrongAuthenticationRequirements
{
PerUserMfaState = PerUserMfaState.Disabled,
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Users["{user-id}"].Authentication.Requirements.PatchAsync(requestBody);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewStrongAuthenticationRequirements()
perUserMfaState := graphmodels.DISABLED_PERUSERMFASTATE
requestBody.SetPerUserMfaState(&perUserMfaState)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
requirements, err := graphClient.Users().ByUserId("user-id").Authentication().Requirements().Patch(context.Background(), requestBody, nil)
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
StrongAuthenticationRequirements strongAuthenticationRequirements = new StrongAuthenticationRequirements();
strongAuthenticationRequirements.setPerUserMfaState(PerUserMfaState.Disabled);
StrongAuthenticationRequirements result = graphClient.users().byUserId("{user-id}").authentication().requirements().patch(strongAuthenticationRequirements);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\StrongAuthenticationRequirements;
use Microsoft\Graph\Beta\Generated\Models\PerUserMfaState;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new StrongAuthenticationRequirements();
$requestBody->setPerUserMfaState(new PerUserMfaState('disabled'));
$result = $graphServiceClient->users()->byUserId('user-id')->authentication()->requirements()->patch($requestBody)->wait();
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.strong_authentication_requirements import StrongAuthenticationRequirements
from msgraph_beta.generated.models.per_user_mfa_state import PerUserMfaState
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = StrongAuthenticationRequirements(
per_user_mfa_state = PerUserMfaState.Disabled,
)
result = await graph_client.users.by_user_id('user-id').authentication.requirements.patch(request_body)
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.