Easy DirSync hard-matching
November 8, 2018•234 words
If you've ever accidentally ended up in a scenario where you have two accounts for the same user in Office 365 - one synced with AD, and one in the cloud - it can be challenging to recover from this. Azure AD Connect generates a value to store as the "ImmutableID" in Azure AD, which uniquely identifies/ties the user to the correct on-premise account.
99 percent of the time this value is derived from ObjectGuid on-premise. There used to be a manual way to generate this value and set it as the immutableID manually, but it appears the way Azure AD Connect is generating this value has changed over time and that value no longer generates correctly.
The easiest way I've found to fix this is to take the value that Azure AD Connect generates for the synced object, then delete both objects, paste that value in to the correct account, and let it all sync back up. Example process:
firstname.lastname@example.org (In Cloud)
email@example.com (UPN Conflict / Synced)
1.) Get-MsolUser -UserPrincipalName firstname.lastname@example.org | select ImmutableID
2.) Copy value and save somewhere
3.) Move email@example.com out of the Azure AD Connect sync scope - i.e. use a temporary OU and exclude from sync, or if you have something like "Disabled Users" already excluded you can use that.
4.) Run sync and confirm account has been deleted.
5.) Set-MsolUser -UserPrincipalName firstname.lastname@example.org -ImmutableID [value saved from earlier]