Restart a stopped synchronization job, forcing it to reprocess all the objects in the directory. Optionally clears existing the synchronization state and previous errors.
Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.
Permission type
Least privileged permissions
Higher privileged permissions
Delegated (work or school account)
Synchronization.ReadWrite.All
Not available.
Delegated (personal Microsoft account)
Not supported.
Not supported.
Application
Application.ReadWrite.OwnedBy
Synchronization.ReadWrite.All
To configure application provisioning or HR-driven provisioning, the calling user must also be assigned at least the Application Administrator or Cloud Application Administratordirectory role.
To configure Microsoft Entra Cloud Sync, the calling user must also be assigned at least the Hybrid Identity Administrator directory role.
HTTP Request
{servicePrincipalId} refers to the id of the service principal object. id is referred to as the Object ID of the enterprise application in app registrations in the Microsoft Entra admin center.
You can address the service principal using either its id or appId. id and appId are referred to as the Object ID and Application (Client) ID, respectively, in app registrations in the Microsoft Entra admin center.
POST /servicePrincipals/{servicePrincipalId}/synchronization/jobs/{jobId}/restart
POST /servicePrincipals(appId='{appId}')/synchronization/jobs/{jobId}/restart
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.ServicePrincipals.Item.Synchronization.Jobs.Item.Restart;
using Microsoft.Graph.Models;
var requestBody = new RestartPostRequestBody
{
Criteria = new SynchronizationJobRestartCriteria
{
ResetScope = SynchronizationJobRestartScope.Watermark | SynchronizationJobRestartScope.Escrows | SynchronizationJobRestartScope.QuarantineState,
},
};
// To initialize your graphClient, see https://video2.skills-academy.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
await graphClient.ServicePrincipals["{servicePrincipal-id}"].Synchronization.Jobs["{synchronizationJob-id}"].Restart.PostAsync(requestBody, (requestConfiguration) =>
{
requestConfiguration.Headers.Add("Authorization", "Bearer <token>");
});
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.serviceprincipals.item.synchronization.jobs.item.restart.RestartPostRequestBody restartPostRequestBody = new com.microsoft.graph.serviceprincipals.item.synchronization.jobs.item.restart.RestartPostRequestBody();
SynchronizationJobRestartCriteria criteria = new SynchronizationJobRestartCriteria();
criteria.setResetScope(EnumSet.of(SynchronizationJobRestartScope.Watermark, SynchronizationJobRestartScope.Escrows, SynchronizationJobRestartScope.QuarantineState));
restartPostRequestBody.setCriteria(criteria);
graphClient.servicePrincipals().byServicePrincipalId("{servicePrincipal-id}").synchronization().jobs().bySynchronizationJobId("{synchronizationJob-id}").restart().post(restartPostRequestBody, requestConfiguration -> {
requestConfiguration.headers.add("Authorization", "Bearer <token>");
});
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see: https://aka.ms/ContentUserFeedback.