PowerShell Hard Link AD Sync User

  • Welcome to ITBible, we're your #1 resource for enterprise or homelab IT problems (or just a place to show off your stuff).
The process of hard linking AD objects to AAD objects for when you get errors during an AD Sync.

On the domain controller run:
PowerShell:
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.
PowerShell:
Connect-MsolService
Set-MsolUser -UserPrincipalName [email protected] -ImmutableId ID_FROM_AD_HERE