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 eines smsAuthenticationMethodConfiguration-Objekts, das die SMS-Authentifizierungsmethodenrichtlinie für den Microsoft Entra Mandanten darstellt.
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) |
Nicht unterstützt |
Nicht unterstützt |
| Anwendung |
Policy.ReadWrite.AuthenticationMethod |
Nicht verfügbar. |
Wichtig
In delegierten Szenarien mit Geschäfts-, Schul- oder Unikonten muss dem angemeldeten Benutzer eine unterstützte Microsoft Entra Rolle oder eine benutzerdefinierte Rolle mit einer unterstützten Rollenberechtigung zugewiesen werden.
Der Authentifizierungsrichtlinienadministrator ist die Rolle mit den geringsten Berechtigungen, die für diesen Vorgang unterstützt wird.
HTTP-Anforderung
PATCH /policies/authenticationMethodsPolicy/authenticationMethodConfigurations/sms
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 |
| excludeTargets |
excludeTarget-Sammlung |
Gruppen von Benutzern, die von der Richtlinie ausgeschlossen sind. |
| state |
authenticationMethodState |
Die möglichen Werte sind: enabled, disabled. |
Anmerkung: Die @odata.type -Eigenschaft mit dem Wert muss #microsoft.graph.smsAuthenticationMethodConfiguration in den Text eingeschlossen werden.
Antwort
Wenn die Methode erfolgreich verläuft, wird der Antwortcode 204 No Content zurückgegeben. Es gibt nichts im Antworttext zurück.
Beispiele
Anforderung
PATCH https://graph.microsoft.com/beta/policies/authenticationMethodsPolicy/authenticationMethodConfigurations/sms
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.smsAuthenticationMethodConfiguration",
"id": "Sms",
"state": "enabled"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new SmsAuthenticationMethodConfiguration
{
OdataType = "#microsoft.graph.smsAuthenticationMethodConfiguration",
Id = "Sms",
State = AuthenticationMethodState.Enabled,
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Policies.AuthenticationMethodsPolicy.AuthenticationMethodConfigurations["{authenticationMethodConfiguration-id}"].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.NewAuthenticationMethodConfiguration()
id := "Sms"
requestBody.SetId(&id)
state := graphmodels.ENABLED_AUTHENTICATIONMETHODSTATE
requestBody.SetState(&state)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
authenticationMethodConfigurations, err := graphClient.Policies().AuthenticationMethodsPolicy().AuthenticationMethodConfigurations().ByAuthenticationMethodConfigurationId("authenticationMethodConfiguration-id").Patch(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
SmsAuthenticationMethodConfiguration authenticationMethodConfiguration = new SmsAuthenticationMethodConfiguration();
authenticationMethodConfiguration.setOdataType("#microsoft.graph.smsAuthenticationMethodConfiguration");
authenticationMethodConfiguration.setId("Sms");
authenticationMethodConfiguration.setState(AuthenticationMethodState.Enabled);
AuthenticationMethodConfiguration result = graphClient.policies().authenticationMethodsPolicy().authenticationMethodConfigurations().byAuthenticationMethodConfigurationId("{authenticationMethodConfiguration-id}").patch(authenticationMethodConfiguration);
const options = {
authProvider,
};
const client = Client.init(options);
const authenticationMethodConfiguration = {
'@odata.type': '#microsoft.graph.smsAuthenticationMethodConfiguration',
id: 'Sms',
state: 'enabled'
};
await client.api('/policies/authenticationMethodsPolicy/authenticationMethodConfigurations/sms')
.version('beta')
.update(authenticationMethodConfiguration);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\SmsAuthenticationMethodConfiguration;
use Microsoft\Graph\Beta\Generated\Models\AuthenticationMethodState;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new SmsAuthenticationMethodConfiguration();
$requestBody->setOdataType('#microsoft.graph.smsAuthenticationMethodConfiguration');
$requestBody->setId('Sms');
$requestBody->setState(new AuthenticationMethodState('enabled'));
$result = $graphServiceClient->policies()->authenticationMethodsPolicy()->authenticationMethodConfigurations()->byAuthenticationMethodConfigurationId('authenticationMethodConfiguration-id')->patch($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Identity.SignIns
$params = @{
"@odata.type" = "#microsoft.graph.smsAuthenticationMethodConfiguration"
id = "Sms"
state = "enabled"
}
Update-MgBetaPolicyAuthenticationMethodPolicyAuthenticationMethodConfiguration -AuthenticationMethodConfigurationId $authenticationMethodConfigurationId -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.sms_authentication_method_configuration import SmsAuthenticationMethodConfiguration
from msgraph_beta.generated.models.authentication_method_state import AuthenticationMethodState
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = SmsAuthenticationMethodConfiguration(
odata_type = "#microsoft.graph.smsAuthenticationMethodConfiguration",
id = "Sms",
state = AuthenticationMethodState.Enabled,
)
result = await graph_client.policies.authentication_methods_policy.authentication_method_configurations.by_authentication_method_configuration_id('authenticationMethodConfiguration-id').patch(request_body)
Antwort
Das folgende Beispiel zeigt die Antwort.
HTTP/1.1 204 No Content