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.
Überprüfen Sie, ob die Anmeldeinformationen im Mandanten gültig sind.
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) |
Synchronization.ReadWrite.All |
Nicht verfügbar. |
Delegiert (persönliches Microsoft-Konto) |
Nicht unterstützt |
Nicht unterstützt |
Anwendung |
Application.ReadWrite.OwnedBy |
Synchronization.ReadWrite.All |
Wichtig
In delegierten Szenarien mit Geschäfts-, Schul- oder Unikonten muss der angemeldete Benutzer Besitzer oder Mitglied der Gruppe sein oder einer unterstützten Microsoft Entra Rolle oder einer benutzerdefinierten Rolle mit einer unterstützten Rollenberechtigung zugewiesen sein. Die folgenden Rollen mit den geringsten Berechtigungen werden für diesen Vorgang unterstützt.
- Anwendungsadministrator
- Cloudanwendungsadministrator
- Hybrididentitätsadministrator: konfigurieren Microsoft Entra Cloudsynchronisierung
HTTP-Anforderung
POST /servicePrincipals/{id}/synchronization/jobs/{id}/validateCredentials
Anforderungstext
Geben Sie im Anforderungstext ein JSON-Objekt mit den folgenden Parametern an.
Parameter |
Typ |
Beschreibung |
useSavedCredentials |
Boolesch |
Bei true wird der credentials Parameter ignoriert, und die zuvor gespeicherten Anmeldeinformationen (falls vorhanden) werden stattdessen überprüft. |
Beglaubigungsschreiben |
synchronizationSecretKeyStringValuePair-Sammlung |
Zu überprüfende Anmeldeinformationen. Wird ignoriert, wenn der useSavedCredentials Parameter ist true . |
templateId |
String |
Definiert Standardeinstellungen für die Bereitstellungskonfiguration. |
Antwort
Wenn die Validierung erfolgreich ist, gibt diese Methode einen 204, No Content
Antwortcode zurück. Es gibt nichts im Antworttext zurück.
Beispiel
Anforderung
Das folgende Beispiel zeigt eine Anfrage.
POST https://graph.microsoft.com/beta/servicePrincipals/{id}/synchronization/jobs/{id}/validateCredentials
Content-type: application/json
{
"credentials": [
{
"key": "UserName",
"value": "user@domain.com"
},
{
"key": "Password",
"value": "password-value"
}
]
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.ServicePrincipals.Item.Synchronization.Jobs.Item.ValidateCredentials;
using Microsoft.Graph.Beta.Models;
var requestBody = new ValidateCredentialsPostRequestBody
{
Credentials = new List<SynchronizationSecretKeyStringValuePair>
{
new SynchronizationSecretKeyStringValuePair
{
Key = SynchronizationSecret.UserName,
Value = "user@domain.com",
},
new SynchronizationSecretKeyStringValuePair
{
Key = SynchronizationSecret.Password,
Value = "password-value",
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
await graphClient.ServicePrincipals["{servicePrincipal-id}"].Synchronization.Jobs["{synchronizationJob-id}"].ValidateCredentials.PostAsync(requestBody);
mgc-beta service-principals synchronization jobs validate-credentials-by-id post --service-principal-id {servicePrincipal-id} --synchronization-job-id {synchronizationJob-id} --body '{\
"credentials": [\
{\
"key": "UserName",\
"value": "user@domain.com"\
},\
{\
"key": "Password",\
"value": "password-value"\
}\
]\
}\
'
// 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"
graphserviceprincipals "github.com/microsoftgraph/msgraph-beta-sdk-go/serviceprincipals"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
requestBody := graphserviceprincipals.NewValidateCredentialsPostRequestBody()
synchronizationSecretKeyStringValuePair := graphmodels.NewSynchronizationSecretKeyStringValuePair()
key := graphmodels.USERNAME_SYNCHRONIZATIONSECRET
synchronizationSecretKeyStringValuePair.SetKey(&key)
value := "user@domain.com"
synchronizationSecretKeyStringValuePair.SetValue(&value)
synchronizationSecretKeyStringValuePair1 := graphmodels.NewSynchronizationSecretKeyStringValuePair()
key := graphmodels.PASSWORD_SYNCHRONIZATIONSECRET
synchronizationSecretKeyStringValuePair1.SetKey(&key)
value := "password-value"
synchronizationSecretKeyStringValuePair1.SetValue(&value)
credentials := []graphmodels.SynchronizationSecretKeyStringValuePairable {
synchronizationSecretKeyStringValuePair,
synchronizationSecretKeyStringValuePair1,
}
requestBody.SetCredentials(credentials)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
graphClient.ServicePrincipals().ByServicePrincipalId("servicePrincipal-id").Synchronization().Jobs().BySynchronizationJobId("synchronizationJob-id").ValidateCredentials().Post(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.beta.serviceprincipals.item.synchronization.jobs.item.validatecredentials.ValidateCredentialsPostRequestBody validateCredentialsPostRequestBody = new com.microsoft.graph.beta.serviceprincipals.item.synchronization.jobs.item.validatecredentials.ValidateCredentialsPostRequestBody();
LinkedList<SynchronizationSecretKeyStringValuePair> credentials = new LinkedList<SynchronizationSecretKeyStringValuePair>();
SynchronizationSecretKeyStringValuePair synchronizationSecretKeyStringValuePair = new SynchronizationSecretKeyStringValuePair();
synchronizationSecretKeyStringValuePair.setKey(SynchronizationSecret.UserName);
synchronizationSecretKeyStringValuePair.setValue("user@domain.com");
credentials.add(synchronizationSecretKeyStringValuePair);
SynchronizationSecretKeyStringValuePair synchronizationSecretKeyStringValuePair1 = new SynchronizationSecretKeyStringValuePair();
synchronizationSecretKeyStringValuePair1.setKey(SynchronizationSecret.Password);
synchronizationSecretKeyStringValuePair1.setValue("password-value");
credentials.add(synchronizationSecretKeyStringValuePair1);
validateCredentialsPostRequestBody.setCredentials(credentials);
graphClient.servicePrincipals().byServicePrincipalId("{servicePrincipal-id}").synchronization().jobs().bySynchronizationJobId("{synchronizationJob-id}").validateCredentials().post(validateCredentialsPostRequestBody);
const options = {
authProvider,
};
const client = Client.init(options);
const validateCredentials = {
credentials: [
{
key: 'UserName',
value: 'user@domain.com'
},
{
key: 'Password',
value: 'password-value'
}
]
};
await client.api('/servicePrincipals/{id}/synchronization/jobs/{id}/validateCredentials')
.version('beta')
.post(validateCredentials);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\ServicePrincipals\Item\Synchronization\Jobs\Item\ValidateCredentials\ValidateCredentialsPostRequestBody;
use Microsoft\Graph\Beta\Generated\Models\SynchronizationSecretKeyStringValuePair;
use Microsoft\Graph\Beta\Generated\Models\SynchronizationSecret;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new ValidateCredentialsPostRequestBody();
$credentialsSynchronizationSecretKeyStringValuePair1 = new SynchronizationSecretKeyStringValuePair();
$credentialsSynchronizationSecretKeyStringValuePair1->setKey(new SynchronizationSecret('userName'));
$credentialsSynchronizationSecretKeyStringValuePair1->setValue('user@domain.com');
$credentialsArray []= $credentialsSynchronizationSecretKeyStringValuePair1;
$credentialsSynchronizationSecretKeyStringValuePair2 = new SynchronizationSecretKeyStringValuePair();
$credentialsSynchronizationSecretKeyStringValuePair2->setKey(new SynchronizationSecret('password'));
$credentialsSynchronizationSecretKeyStringValuePair2->setValue('password-value');
$credentialsArray []= $credentialsSynchronizationSecretKeyStringValuePair2;
$requestBody->setCredentials($credentialsArray);
$graphServiceClient->servicePrincipals()->byServicePrincipalId('servicePrincipal-id')->synchronization()->jobs()->bySynchronizationJobId('synchronizationJob-id')->validateCredentials()->post($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Applications
$params = @{
credentials = @(
@{
key = "UserName"
value = "user@domain.com"
}
@{
key = "Password"
value = "password-value"
}
)
}
Test-MgBetaServicePrincipalSynchronizationJobCredential -ServicePrincipalId $servicePrincipalId -SynchronizationJobId $synchronizationJobId -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.serviceprincipals.item.synchronization.jobs.item.validate_credentials.validate_credentials_post_request_body import ValidateCredentialsPostRequestBody
from msgraph_beta.generated.models.synchronization_secret_key_string_value_pair import SynchronizationSecretKeyStringValuePair
from msgraph_beta.generated.models.synchronization_secret import SynchronizationSecret
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = ValidateCredentialsPostRequestBody(
credentials = [
SynchronizationSecretKeyStringValuePair(
key = SynchronizationSecret.UserName,
value = "user@domain.com",
),
SynchronizationSecretKeyStringValuePair(
key = SynchronizationSecret.Password,
value = "password-value",
),
],
)
await graph_client.service_principals.by_service_principal_id('servicePrincipal-id').synchronization.jobs.by_synchronization_job_id('synchronizationJob-id').validate_credentials.post(request_body)
Antwort
Das folgende Beispiel zeigt die Antwort.
HTTP/1.1 204 No Content