Update emailAuthenticationMethodConfiguration
Article
08/31/2022
2 minutes to read
8 contributors
Feedback
In this article
Namespace: microsoft.graph
Update the properties of an emailAuthenticationMethodConfiguration object, which represents the email OTP authentication method policy for the Azure Active Directory (Azure AD) tenant.
Permissions
One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions .
Permission type
Permissions (from least to most privileged)
Delegated (work or school account)
Policy.ReadWrite.AuthenticationMethod
Delegated (personal Microsoft account)
Not supported.
Application
Policy.ReadWrite.AuthenticationMethod
For delegated scenarios, the administrator needs one of the following Azure AD roles :
Authentication Policy Administrator
Global Administrator
HTTP request
PATCH /policies/authenticationMethodsPolicy/authenticationMethodConfigurations/email
Name
Description
Authorization
Bearer {token}. Required.
Content-Type
application/json. Required.
Request body
In the request body, supply a JSON representation of the emailAuthenticationMethodConfiguration object. Existing properties that are not included in the request body will maintain their previous values or be recalculated based on changes to other property values. For best performance, don't include existing values that haven't changed.
For the list of properties that can be updated, see emailAuthenticationMethodConfiguration .
Note: The @odata.type
property with a value of #microsoft.graph.emailAuthenticationMethodConfiguration
must be included in the body.
Response
If successful, this method returns a 204 No Content
response code. It does not return anything in the response body.
Examples
Request
PATCH https://graph.microsoft.com/v1.0/policies/authenticationMethodsPolicy/authenticationMethodConfigurations/email
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.emailAuthenticationMethodConfiguration",
"allowExternalIdToUseEmailOtp": "enabled",
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var authenticationMethodConfiguration = new EmailAuthenticationMethodConfiguration
{
AllowExternalIdToUseEmailOtp = ExternalEmailOtpState.Enabled
};
await graphClient.Policies.AuthenticationMethodsPolicy.AuthenticationMethodConfigurations["{authenticationMethodConfiguration-id}"]
.Request()
.UpdateAsync(authenticationMethodConfiguration);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
const options = {
authProvider,
};
const client = Client.init(options);
const authenticationMethodConfiguration = {
'@odata.type': '#microsoft.graph.emailAuthenticationMethodConfiguration',
allowExternalIdToUseEmailOtp: 'enabled',
};
await client.api('/policies/authenticationMethodsPolicy/authenticationMethodConfigurations/email')
.update(authenticationMethodConfiguration);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
EmailAuthenticationMethodConfiguration authenticationMethodConfiguration = new EmailAuthenticationMethodConfiguration();
authenticationMethodConfiguration.allowExternalIdToUseEmailOtp = ExternalEmailOtpState.ENABLED;
graphClient.policies().authenticationMethodsPolicy().authenticationMethodConfigurations("email")
.buildRequest()
.patch(authenticationMethodConfiguration);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
requestBody := graphmodels.NewAuthenticationMethodConfiguration()
additionalData := map[string]interface{}{
"allowExternalIdToUseEmailOtp" : "enabled",
}
requestBody.SetAdditionalData(additionalData)
result, err := graphClient.Policies().AuthenticationMethodsPolicy().AuthenticationMethodConfigurationsById("authenticationMethodConfiguration-id").Patch(context.Background(), requestBody, nil)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
Import-Module Microsoft.Graph.Identity.SignIns
$params = @{
"@odata.type" = "#microsoft.graph.emailAuthenticationMethodConfiguration"
AllowExternalIdToUseEmailOtp = "enabled"
}
Update-MgPolicyAuthenticationMethodPolicyAuthenticationMethodConfiguration -AuthenticationMethodConfigurationId $authenticationMethodConfigurationId -BodyParameter $params
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
<?php
// THIS SNIPPET IS A PREVIEW FOR THE KIOTA BASED SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($requestAdapter);
$requestBody = new AuthenticationMethodConfiguration();
$requestBody->set@odatatype('#microsoft.graph.emailAuthenticationMethodConfiguration');
$additionalData = [
'allowExternalIdToUseEmailOtp' => 'enabled',
];
$requestBody->setAdditionalData($additionalData);
$requestResult = $graphServiceClient->policies()->authenticationMethodsPolicy()->authenticationMethodConfigurationsById('authenticationMethodConfiguration-id')->patch($requestBody);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
Response
HTTP/1.1 204 NO CONTENT