Home › Azure AD Connect › 8505

Azure AD Connect · 8505 · Azure AD Connect / Microsoft Entra Connect

Azure AD Connect Error 8505: Export Failure Referenced Object Not Found

Sync fails because a referenced object like a manager is out of scope or deleted. Fix by expanding sync filters or restoring the missing object from Azure AD recycle bin.

Error Details

FactValueSourceNote
Exact error string8505 referenced-object-not-foundSynchronization Service Manager OperationsIndicates dependency ordering failure during export
Affected Build RangeAzure AD Connect / Microsoft Entra ConnectProduct DocumentationApplies to all versions using the sync engine
Relevant Registry KeyHKLM\SOFTWARE\Microsoft\AzureADConnectWindows RegistryContains configuration for sync service behavior
Relevant Service Endpointhttps://graph.microsoft.com/v1.0/directory/deletedItemsMicrosoft Graph APIUsed to check for soft-deleted objects in Azure AD
Log Line SignatureExport failed for object ... Error: 8505C:\Program Files\Microsoft Azure AD Sync\Data\AADSync*.logVerbose logging required to see full DN of missing reference

Log Files to Check

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:

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

  1. 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.
  2. 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.
  3. 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>
  4. 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.
  5. Run Full Sync Cycle: Open PowerShell as Administrator and execute: Import-Module ADSync Start-ADSyncSyncCycle -PolicyType Initial Monitor the progress in Synchronization Service Manager.
  6. Verify Registry Settings: Ensure that the sync engine is not throttled. Check the registry key HKLM\SOFTWARE\Microsoft\AzureADConnect for 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.

Warning: Do not manually delete objects from the Azure AD connector space in Synchronization Service Manager unless you are certain they are stale. This can cause permanent data loss and require a full re-provisioning of the tenant.
Tip: Use the Get-ADSyncConnectorRunStatus cmdlet to quickly identify which connector is failing without navigating through the GUI. This saves time during high-pressure troubleshooting scenarios.

Sources & References

Related Guides

Get new error code fixes by email

Product-specific solutions for Intune, Autopilot, SCCM and Entra ID — straight to your inbox. No spam.