A while ago, I posted an article that described how to convert a cloud user into an Entra ID snyched user from local. See https://www.ajni.it/2022/05/convert-already-microsoft-365-cloud-users-into-azure-ad-synced-users/. This article describes roughly the procedure but it does not work anymore because the PowerShell Module is outdated. Here is how you can do it in 2025:

Preferrably, you will execute this on a computer that both has Active Directory Module and Microsoft.Graph Module.

Install-Module Microsoft.Graph

connect-mggraph -scopes “user.readwrite.all” (select for entire organization)

$upn = “aku@ajni.it”
The objectGUID needs to be in Base64 format.
$id = [system.convert]::ToBase64String((Get-ADUser -filter {userprincipalname -eq $upn}).objectGUid.ToByteArray())

Update-MgUser -UserId $upn -OnPremisesImmutableId $id

Start-ADSyncSyncCycle -PolicyType Delta

Enjoy!