Summary
This article provides guidance on resolving an issue in which a deleted on-premises Active Directory object isn't removed from Microsoft Entra ID when directory synchronization is used in Office 365, Azure, or Microsoft Intune.
Original product version: Cloud Services (Web roles/Worker roles), Microsoft Entra ID, Microsoft Intune, Azure Backup, Office 365 Identity Management
Original KB number: 2709902
Symptoms
Consider the following scenario:
- You have an on-premises Active Directory object.
- Directory synchronization is used to sync the Active Directory object to Microsoft Entra ID. It creates a linked object.
- You delete the on-premises Active Directory object.
In this scenario, the linked object isn't removed from Microsoft Entra ID.
Cause
This issue may occur if one of the following conditions is true:
- Directory synchronization hasn't yet occurred.
- Directory synchronization unexpectedly failed to delete a specific cloud object and results in an orphaned Microsoft Entra object.
Resolution
To fix this issue, follow these steps:
-
Make sure that the Microsoft Graph PowerShell module and ADSyncTools PowerShell module are installed.
-
Run the following ADSync command to force directory synchronization:
Start-ADSyncSyncCycle -PolicyType Initial -
If sync is working correctly but the Active Directory object deletion is still not propagated to Microsoft Entra ID, manually remove the orphaned object. To do so, use one of the following Microsoft Graph PowerShell cmdlets:
For example, to manually remove orphaned user ID
john.smith@contoso.comthat was originally created by using directory synchronization, you would run the following cmdlet:$user = Get-MgUser -Filter "userPrincipalName eq 'john.smith@contoso.com'" Remove-MgUser -UserId $user.id
Source: Microsoft Learn / IT Pro troubleshooting by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.
