Hossain Labs

Home / Blog / Entra ID and Intune

Bulk Hard-Matching Entra ID Users After an On-Premises AD Rebuild

By Md Sajid Hossain20 November 20261 min read

After an on-premises directory rebuild, around 6,000 users were in scope for synchronization. Some users had two identities: the original account with their mailbox and a new account created by sync. The first task was to identify which account held the data.

Identify the account that holds the data

In this case the original cloud identity held the mailbox, Teams history, OneDrive content and licenses. The rebuilt directory supplied new objects. A matching UPN was a clue, but insufficient evidence that two records belonged together.

Compare a single pair

Record the cloud object ID, UPN, primary SMTP address, sync status and onPremisesImmutableId. In the rebuilt directory, record the corresponding object GUID and configured source anchor. Confirm the tenant’s actual anchor configuration before interpreting a difference.

PowerShell
Connect-MgGraph -Scopes "User.Read.All"
Get-MgUser -UserId user@contoso.com -Property Id,UserPrincipalName,OnPremisesSyncEnabled,OnPremisesImmutableId |
    Select-Object Id,UserPrincipalName,OnPremisesSyncEnabled,OnPremisesImmutableId

Interpret the matching error

Entra Connect uses the source anchor for hard matching. Where applicable, soft matching uses attributes such as the UPN or primary SMTP address. A duplicate address, a blocked takeover or an object already bound to another identity needs its own diagnosis. Match the actual sync error against Microsoft’s troubleshooting guidance.

Microsoft documents automatic hard-match hardening from July 1, 2026, including checks involving onPremisesObjectIdentifier. Tenant takeover settings and privileged identities also matter. Escalate a protected match for review before changing identity attributes, synchronization scope or role assignments.

Plan the recovery in batches

Build a reconciliation list pairing each verified cloud object ID with one on-premises identity. Separate ambiguous pairs. For a pilot account, compare the sync preview with the intended result, then verify the cloud object ID, mailbox access and sign-in after synchronization. Expand only after those checks succeed.

References

Md Sajid Hossain

Modern Workplace & Data Security Engineer in Dhaka. Microsoft 365, Purview, Entra ID and Exchange, from real tenants and support cases.

Work with me · LinkedIn