Hard Link AD Sync User

The process of hard linking AD objects to AAD objects for when you get errors during an AD Sync.

On the domain controller run:

Get-ADUser username | Select-Object UserPrincipalName, objectGUID, @{Name = 'ImmutableID'; Expression = { [system.convert]::ToBase64String(([GUID]$_.objectGUID).ToByteArray()) } }

Transfer the Immutable ID from AD over to the code below and run this against the user in AAD.

Connect-MsolService
Set-MsolUser -UserPrincipalName [email protected] -ImmutableId ID_FROM_AD_HERE