How do you merge a user account in AD with one in MS365?

Miranda Weingartner 20 Reputation points
2025-08-20T14:30:32.1666667+00:00

I accidentally deleted the wrong account in our local AD. I still have the account in M365, which is great, because he still has access to files and e-mail.

Then I created a new account in AD, but now he has two accounts. One in AD and one in MS365. How do I merge the two?

Windows for business | Windows Client for IT Pros | Directory services | Active Directory

Answer accepted by question author
Quinnie Quoc 11,855 Reputation points Independent Advisor
2025-08-21T06:05:28+00:00

Hi Miranda Weingartner,

I hope this message finds you well.

To properly merge these and restore synchronization, here’s what you can do:

Recommended Steps to Reconnect the AD Account with M365

  1. Match the Immutable ID
    • Microsoft 365 uses an attribute called ImmutableID to link AD accounts to cloud identities.
    • First, retrieve the ImmutableID from the existing M365 account: powershell
           Get-MsolUser -UserPrincipalName ******@domain.com | Select ImmutableId
      
  2. Set the Same ImmutableID in AD
    • On the newly created AD account, use PowerShell to set the ms-DS-ConsistencyGuid (or objectGUID, depending on your sync method) to match the ImmutableID.
    • If you're using Entra Connect, ensure the new AD account has the same userPrincipalName (UPN) and mail attributes as the M365 account.
  3. Force Synchronization
    • Run a delta sync using Entra Connect: powershell
           Start-ADSyncSyncCycle -PolicyType Delta
      
    • This should re-link the AD account with the existing cloud identity.
  4. Verify Sync Status
    • In the Microsoft Entra admin center, confirm that the account is now showing as "Synced from AD" and not as a cloud-only account.

Important Notes

Avoid deleting the M365 account, as this would result in data loss.

If you're unsure about the ImmutableID mapping, consider using Soft Match (matching via UPN and mail attributes) if ImmutableID is not enforced.

Always back up user data and test changes in a staging environment if possible.

Let me know if you'd like help running these commands or verifying the sync status. I’d be happy to assist further to ensure the accounts are properly merged.

Best regards,

Quinnie Quoc.

Was this answer helpful?


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.