Namespace: microsoft.graph
Wichtig
Die APIs unter der /beta Version in Microsoft Graph können sich ändern. Die Verwendung dieser APIs in Produktionsanwendungen wird nicht unterstützt. Um festzustellen, ob eine API in v1.0 verfügbar ist, verwenden Sie die Version Selektor.
Aktualisieren Sie die Eigenschaften des Objekts b2cAuthenticationMethodsPolicy.
Diese API ist in den folgenden nationalen Cloudbereitstellungen verfügbar.
| Weltweiter Service |
US Government L4 |
US Government L5 (DOD) |
China, betrieben von 21Vianet |
| ✅ |
✅ |
✅ |
✅ |
Berechtigungen
Wählen Sie die Berechtigungen aus, die für diese API als am wenigsten privilegiert markiert sind. Verwenden Sie eine höhere Berechtigung oder Berechtigungen nur, wenn Ihre App dies erfordert. Ausführliche Informationen zu delegierten Berechtigungen und Anwendungsberechtigungen finden Sie unter Berechtigungstypen. Weitere Informationen zu diesen Berechtigungen finden Sie in der Berechtigungsreferenz.
| Berechtigungstyp |
Berechtigungen mit den geringsten Berechtigungen |
Berechtigungen mit höheren Berechtigungen |
| Delegiert (Geschäfts-, Schul- oder Unikonto) |
Policy.ReadWrite.AuthenticationMethod |
Nicht verfügbar. |
| Delegiert (persönliches Microsoft-Konto) |
Policy.ReadWrite.AuthenticationMethod |
Nicht verfügbar. |
| Anwendung |
Policy.ReadWrite.AuthenticationMethod |
Nicht verfügbar. |
HTTP-Anforderung
PATCH /policies/b2cAuthenticationMethodsPolicy
Anforderungstext
Geben Sie im Anforderungstext nur die Werte für zu aktualisierende Eigenschaften an. Vorhandene Eigenschaften, die nicht im Anforderungstext enthalten sind, behalten ihre vorherigen Werte bei oder werden basierend auf Änderungen an anderen Eigenschaftswerten neu berechnet.
In der folgenden Tabelle sind die Eigenschaften angegeben, die aktualisiert werden können.
| Eigenschaft |
Typ |
Beschreibung |
| isEmailPasswordAuthenticationEnabled |
Boolesch |
Wenn die E-Mail- und Kennwortauthentifizierungsmethode aktiviert ist, kann der Mandantenadministrator lokale Konten mithilfe von E-Mail konfigurieren. |
| isUserNameAuthenticationEnabled |
Boolesch |
Der Mandantenadministrator kann lokale Konten mithilfe des Benutzernamens konfigurieren, wenn die Authentifizierungsmethode für Benutzername und Kennwort aktiviert ist. |
| isPhoneOneTimePasswordAuthenticationEnabled |
Boolescher Wert |
Der Mandantenadministrator kann lokale Konten mithilfe der Telefonnummer konfigurieren, wenn die Telefonnummer und die Methode zur Authentifizierung mit einem Einmalkennwort aktiviert ist. |
Antwort
Wenn die Methode erfolgreich verläuft, werden der Antwortcode 204 No Content und ein leerer Antworttext zurückgegeben.
Beispiele
Anforderung
Das folgende Beispiel zeigt eine Anfrage.
PATCH https://graph.microsoft.com/beta/policies/b2cAuthenticationMethodsPolicy
{
"isEmailPasswordAuthenticationEnabled": false,
"isUserNameAuthenticationEnabled": true,
"isPhoneOneTimePasswordAuthenticationEnabled": true
}
// 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 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.NewB2cAuthenticationMethodsPolicy()
isEmailPasswordAuthenticationEnabled := false
requestBody.SetIsEmailPasswordAuthenticationEnabled(&isEmailPasswordAuthenticationEnabled)
isUserNameAuthenticationEnabled := true
requestBody.SetIsUserNameAuthenticationEnabled(&isUserNameAuthenticationEnabled)
isPhoneOneTimePasswordAuthenticationEnabled := true
requestBody.SetIsPhoneOneTimePasswordAuthenticationEnabled(&isPhoneOneTimePasswordAuthenticationEnabled)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
b2cAuthenticationMethodsPolicy, err := graphClient.Policies().B2cAuthenticationMethodsPolicy().Patch(context.Background(), requestBody, nil)
// 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);
const options = {
authProvider,
};
const client = Client.init(options);
const b2cAuthenticationMethodsPolicy = {
isEmailPasswordAuthenticationEnabled: false,
isUserNameAuthenticationEnabled: true,
isPhoneOneTimePasswordAuthenticationEnabled: true
};
await client.api('/policies/b2cAuthenticationMethodsPolicy')
.version('beta')
.update(b2cAuthenticationMethodsPolicy);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\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();
Import-Module Microsoft.Graph.Beta.Identity.SignIns
$params = @{
isEmailPasswordAuthenticationEnabled = $false
isUserNameAuthenticationEnabled = $true
isPhoneOneTimePasswordAuthenticationEnabled = $true
}
Update-MgBetaPolicyB2CAuthenticationMethodPolicy -BodyParameter $params
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.b2c_authentication_methods_policy import B2cAuthenticationMethodsPolicy
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = B2cAuthenticationMethodsPolicy(
is_email_password_authentication_enabled = False,
is_user_name_authentication_enabled = True,
is_phone_one_time_password_authentication_enabled = True,
)
result = await graph_client.policies.b2c_authentication_methods_policy.patch(request_body)
Antwort
Das folgende Beispiel zeigt die Antwort.
HTTP/1.1 204 NO CONTENT