Fixing Office 365 DirSync account matching issues

Recently I had to fix some issues with DirSync. For some reason (there were some cloud users created before DirSync was enabled) there were duplicate users, because DirSync failed to match the already present cloud user and the corresponding AD (Active Directory) user. There were also accounts that failed to sync and thus failed to sync all attributes properly.

If there is already a cloud account and there is need for a synced account, you can create an AD account in DirSynced OU’s. But be sure to create the user with a full UPN matching the one in Office 365 and SMTP addresses that are present on the Cloud account. With the next sync it should match both accounts. If not, it fails matching and you end up with either duplicate accounts (one cloud user and a DirSynced user with the same name/lastname/displayname) or get an InvalidSoftMatch.

When UPN/SMTP matching failed you can merge those accounts again by setting the ImmutableID on the Office 365 account (MsolUser) which is derived from the AD user’s ObjectGuid. You can only add this attribute to Office 365 accounts. After this is set, DirSync should match the accounts correctly.

So, how did I resolve this? See below:

When there are duplicates:

Remove user from DirSync (move to OU which is not synced, will only work when OU Filtering is used. If not, disable DirSync…).

10 comments

Sync’d a full AD and one user duplicated. Couldn’t figure it out but this article saved me.
I also had to change the users UPN to the onmicrosoft account to link the GUID so I guess that was causing the problem from some reason.

Any idea if this works when users have been synced to a different AD in the past and trying to sync to a new AD?

This complete article is stolen from the original blogs.msdn.microsoft.com/vilath/2015/05/26/how-to-fix-office-365-aadsync-smtpupn-matching-issues/ without any references.
WTF dude?! Reported to EU MVP leads.

Hi, thank you for bringing this to my attention.
However, you might want to check publication date of both posts. My post predates the one you found and aligns better with the dates found in the screenshot.