// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new B2cAuthenticationMethodsPolicy
{
IsEmailPasswordAuthenticationEnabled = false,
IsUserNameAuthenticationEnabled = true,
IsPhoneOneTimePasswordAuthenticationEnabled = true,
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Policies.B2cAuthenticationMethodsPolicy.PatchAsync(requestBody);
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
B2cAuthenticationMethodsPolicy b2cAuthenticationMethodsPolicy = new B2cAuthenticationMethodsPolicy();
b2cAuthenticationMethodsPolicy.setIsEmailPasswordAuthenticationEnabled(false);
b2cAuthenticationMethodsPolicy.setIsUserNameAuthenticationEnabled(true);
b2cAuthenticationMethodsPolicy.setIsPhoneOneTimePasswordAuthenticationEnabled(true);
B2cAuthenticationMethodsPolicy result = graphClient.policies().b2cAuthenticationMethodsPolicy().patch(b2cAuthenticationMethodsPolicy);
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\B2cAuthenticationMethodsPolicy;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new B2cAuthenticationMethodsPolicy();
$requestBody->setIsEmailPasswordAuthenticationEnabled(false);
$requestBody->setIsUserNameAuthenticationEnabled(true);
$requestBody->setIsPhoneOneTimePasswordAuthenticationEnabled(true);
$result = $graphServiceClient->policies()->b2cAuthenticationMethodsPolicy()->patch($requestBody)->wait();