Azure Active Directory Sync – Choose Specific OUs
Most Common Mistakes. On First Run – Admins – Run Azure Active Directory Sync and Choosing the whole domain/directory to sync.
And later realize they sync so much garbage accounts to Cloud.
Lets see how to cleanup this mess.
Open Azure Active Directory PowerShell.
Set-ADSyncScheduler –SyncCycleEnabled $False |
Open Azure Synchronization Service Manager.
Right Click Properties.
Choose Containers –
Choose the OUs you need who has users and groups and computers which are running
Now run a Full Import
Now you can see the Deletes –
if you see below error
Stopped-deletion-Threshold-exceeded.
Disable (Prevents accidental deletes) – Temporarily. use below command
Disable-ADSyncExportDeletionThreshold |
Enabled it back (Prevents accidental deletes)
Enable-ADSyncExportDeletionThreshold |
Enable Sync Scheduler Back.
Set-ADSyncScheduler –SyncCycleEnabled $True |