Hello,
Here is the solution:
- In the domain A, delete the user
- Synchronize with AAD
- In Entra ID (O365), restore the deleted user from the trash (this user is no more synchronized)
- In the domain B, create the same user with the same parameters (in a non sync OU)
- Launch the following commands to get the AD id of the user:
import-module ActiveDirectory $user = Get-ADUser -Filter 'SamAccountName -like "username_de_lutilisateur"' $immutableid = [System.Convert]::ToBase64String($user.ObjectGUID.tobytearray())
- Launch the following commands to set this AD id to the user in O365:
Get-AzureADUser (to get the object id of the destination user)
Set-AzureADUser -ObjectId objectid -ImmutableId $immutableid
- In the domain B, move the user to a sync OU
- Synchronize with AAD