Error Details
| Fact | Value | Source | Note |
|---|---|---|---|
| Exact error string | 8505 referenced-object-not-found | Synchronization Service Manager Operations | Indicates dependency ordering failure during export |
| Affected Build Range | Azure AD Connect / Microsoft Entra Connect | Product Documentation | Applies to all versions using the sync engine |
| Relevant Registry Key | HKLM\SOFTWARE\Microsoft\AzureADConnect | Windows Registry | Contains configuration for sync service behavior |
| Relevant Service Endpoint | https://graph.microsoft.com/v1.0/directory/deletedItems | Microsoft Graph API | Used to check for soft-deleted objects in Azure AD |
| Log Line Signature | Export failed for object ... Error: 8505 | C:\Program Files\Microsoft Azure AD Sync\Data\AADSync*.log | Verbose logging required to see full DN of missing reference |
Log Files to Check
C:\Program Files\Microsoft Azure AD Sync\Data\AADSync*.logC:\Windows\Logs\AzureADConnectHealthAgent.log
What This Error Actually Means
Error code 8505 referenced-object-not-found is a critical synchronization failure within the Microsoft Entra Connect (formerly Azure AD Connect) sync engine. It indicates a dependency ordering violation during the export phase to the cloud directory. Specifically, the sync engine attempts to provision or update an object—typically a user or group—but that object contains an attribute referencing another object (such as manager, directReports, or group membership) that does not currently exist in the target connector space (Microsoft Entra ID). This is not merely a missing attribute; it is a structural integrity failure where the graph relationship cannot be resolved because the target node of the relationship is absent from the cloud directory state known to the sync engine.
The component raising this error is the Microsoft Identity Manager (MIM) Synchronization Service, specifically during the Export step of the synchronization cycle. The sync engine validates object references before committing changes to ensure referential integrity in Azure AD. When it encounters a reference to an object that has been deleted from Azure AD, was never synced due to scope exclusions, or is pending deletion, it aborts the export for the dependent object and logs error 8505. This prevents orphaned references in the cloud directory, which could lead to authentication failures or broken group memberships. Understanding this mechanism is crucial: the error is not about the primary object being invalid, but about its context being incomplete.
Affected Versions and Scope
This error affects all builds of Azure AD Connect / Microsoft Entra Connect that utilize the standard MIM-based synchronization engine. It is prevalent in multi-forest topologies, environments with complex OU filtering, and tenants where manual deletions occur in Azure AD without corresponding on-premises changes. The issue is most common in versions post-1.5.3000.0, where referential integrity checks were tightened to prevent data corruption in the cloud directory. It does not affect scenarios using Password Hash Sync (PHS) alone for authentication without full object synchronization, as PHS does not export manager or group membership attributes that trigger these dependency checks. However, if you are using Azure AD Connect Health for monitoring, this error will appear regardless of the specific feature set enabled, provided that object synchronization is active.
The scope of impact depends on your directory structure. If you have a flat OU structure with no exclusions, this error is rare. It becomes frequent in environments where:
- Users are moved between OUs that are included/excluded from sync.
- Manager attributes are set to accounts that are excluded from synchronization (e.g., service accounts or external contractors).
- Groups contain members that have been soft-deleted in Azure AD but still exist on-premises.
Where To Look First: Logs and Event IDs
To diagnose error 8505, you must inspect the synchronization logs and Windows Event Viewer. The primary source of truth is the Synchronization Service Manager, but for detailed troubleshooting, you need to dive into the log files.
Log File Analysis:
Open the sync engine log located at C:\Program Files\Microsoft Azure AD Sync\Data\AADSync*.log. Search for the literal string: Export failed for object ... Error: 8505. This line will provide the DN of the failing object and, crucially, the DN of the missing referenced object. Additionally, check C:\Windows\Logs\AzureADConnectHealthAgent.log if you are using Azure AD Connect Health, as it may report InvalidSoftMatch or ObjectTypeMismatch errors correlated with this sync failure.
Event Viewer:
Navigate to Applications and Services Logs > Microsoft > AD FS > AzureADSyncEngine. Look for Event ID 6202, which indicates a general synchronization error, and Event ID 6104, which often precedes export failures. These events will reference the specific connector space and the step where the failure occurred.
Root Causes
Out-of-Scope Manager or Member References
The most common cause is that a user’s manager attribute points to an account that is excluded from synchronization. This happens when the manager’s AD account resides in an OU that is not included in the Azure AD Connect sync scope, or if the manager account has been filtered out via attribute rules. The sync engine tries to export the employee, sees the manager reference, checks the cloud connector space, finds no matching object for the manager, and throws 8505.
Soft-Deleted Objects in Azure AD
If an object was deleted from Azure AD (not just on-premises), it enters a 30-day soft-delete state. The sync engine may still see the on-premises object and attempt to re-sync it, but the cloud directory rejects the reference because the target is in the recycle bin. This is common when admins delete users directly in the Microsoft 365 admin center without disabling them on-premises first.
Multi-Forest Sync Delays
In multi-forest environments, if a user in Forest A references a manager in Forest B, and Forest B’s sync cycle has not yet completed or failed, the referenced object will not exist in the Azure AD connector space. This timing mismatch causes 8505 until both forests are in sync.
Fix Procedure
- Identify the Missing Reference: Open Synchronization Service Manager, go to
Operations, and find the failed export step. Note the DN of the missing referenced object from the error details. - Check Sync Scope: In Azure AD Connect, run
Configure > Customize Synchronization Options. Verify that the OU containing the missing manager/member is included in the sync scope. If it is excluded, expand the filter or move the object to an included OU. - Restore Soft-Deleted Objects: If the object was deleted from Azure AD, restore it using PowerShell. Connect to Microsoft Graph and run:
Get-MgDirectoryDeletedItem -Filter "displayName eq 'MissingManagerName'"Then restore it with:Restore-MgDirectoryDeletedItem -DirectoryObjectId <ObjectID> - Clear Stale Cache (If Needed): If the object exists but is not syncing, you may need to clear the sync cache. Stop the Sync Service, delete the contents of
C:\ProgramData\Microsoft Azure AD Sync\Cache, and restart the service. Then run a Full Sync. - Run Full Sync Cycle: Open PowerShell as Administrator and execute:
Import-Module ADSyncStart-ADSyncSyncCycle -PolicyType InitialMonitor the progress in Synchronization Service Manager. - Verify Registry Settings: Ensure that the sync engine is not throttled. Check the registry key
HKLM\SOFTWARE\Microsoft\AzureADConnectfor any custom throttle settings that might be delaying object creation.
Error Code Variants
| Error Code | Description | Distinguishing Factor |
|---|---|---|
8505 |
Referenced object not found | Dependency failure; target object missing in cloud. |
8506 |
Object already exists | Duplicate key conflict; usually due to immutable ID mismatch. |
8507 |
Invalid attribute value | Data format error (e.g., invalid email syntax), not a reference issue. |
Verification
To prove the fix worked, monitor the next synchronization cycle. In Synchronization Service Manager, ensure the Export step completes with Succeeded. Check the log file C:\Program Files\Microsoft Azure AD Sync\Data\AADSync*.log for the absence of Error: 8505. Additionally, verify in the Microsoft Entra admin center that the previously failing object now has the correct manager or group membership populated. You can also use PowerShell to confirm the attribute:
Get-MgUser -UserId <UserID> -Property manager
The output should show a valid manager ID, not null or an error.
Prevention
To prevent recurrence, implement strict OU governance. Ensure that all accounts referenced by synced objects (managers, group members) are included in the synchronization scope. Use Azure AD Connect Health alerts to notify admins of sync failures immediately. Additionally, configure a retention policy for deleted objects in Azure AD to allow for easier recovery. For Intune-managed devices, ensure that device enrollment policies do not conflict with user provisioning. You can enforce compliance by setting the OMA-URI ./Device/Vendor/MSFT/ManagedDevices/Enrollment/AllowSyncWithAzureAD to true to ensure consistent state. Finally, educate admins to always disable on-premises accounts before deleting them in Azure AD to avoid soft-delete conflicts.
Get-ADSyncConnectorRunStatus cmdlet to quickly identify which connector is failing without navigating through the GUI. This saves time during high-pressure troubleshooting scenarios.