Step 6

Lock it down

Two settings protect existing cloud accounts from being taken over by sync. Turn them on once the first sync has finished.

5 minutesNeeds Hybrid Identity Administrator or Global Administrator

What they stop

  • Soft match: sync links an AD user to an existing cloud account with the same email address or UPN. Someone could create an AD account to take over a cloud-only admin.
  • Hard match takeover: the same, using the account's immutable ID.

With both blocked, a clash shows as a sync error instead.

Turn them on

PowerShell
Connect-MgGraph -TenantId contoso.onmicrosoft.com -Scopes "OnPremDirectorySynchronization.ReadWrite.All" -NoWelcome
$sync = Get-MgDirectoryOnPremiseSynchronization
Update-MgDirectoryOnPremiseSynchronization -OnPremisesDirectorySynchronizationId $sync.Id -Features @{
  BlockSoftMatchEnabled = $true
  BlockCloudObjectTakeoverThroughHardMatchEnabled = $true
}
(Get-MgDirectoryOnPremiseSynchronization).Features |
  Select-Object BlockSoftMatchEnabled, BlockCloudObjectTakeoverThroughHardMatchEnabled

The sync service account

The agent creates a cloud account called ADToAADSyncServiceAccount@contoso.onmicrosoft.com. Leave it alone. If you build Conditional Access policies, exclude it from MFA rules or sync stops.

Done when

Check

Both features show True. For resilience, follow Add a second Cloud Sync agent.

Your progress is kept in this browser only.