Hello Alphonse Sossou,
Line 3 ($immutableID
) is not a mistake. It's simply used to display the value calculated in step 2, allowing you to view or verify the Base64-encoded ImmutableId before using it.
You will use the value from step 2 in the next command to set the ImmutableId.
Since the MSOnline PowerShell module is deprecated, it’s expected that cmdlets may now return errors, even for Global Admins.
Alternatively, you can make use of Microsoft Graph PowerShell SDK to achieve the same.
Install the Microsoft Graph PowerShell SDK:
Install-Module -Name Microsoft.Graph -Scope CurrentUser -AllowClobber -Force
Now, authenticate to Microsoft Graph with the following command, signing in with your Global Admin account:
Connect-MgGraph -Scopes "User.ReadWrite.All"."Directory.AccessAsUser.All"
Set the ImmutableId
and verify it using below commands:
Update-MgUser -UserId ******@domain.com -OnPremisesImmutableId "xcxxxxxxxxxx"
Get-MgUser -UserId ******@domain.com -Property UserPrincipalName,OnPremisesImmutableId | Select-Object UserPrincipalName,OnPremisesImmutableId

For more information, refer to the installation guide and the retirement announcement.
Once this is done, the user should sync correctly with Azure AD, and Outlook should connect to the existing mailbox as expected.
Hope this helps!
If this answers your query, do click Accept Answer
and Yes
for was this answer helpful, which may help members with similar questions.

If you have any other questions or are still experiencing issues, feel free to ask in the "comments" section, and I'd be happy to help.