Change On-premises immutable ID

Francesco Tottoli 20 Reputation points
2025-10-06T15:30:19.6366667+00:00

I have Office 365 and some users are synchronized with the on-premise Active Directory.

I have a synchronized user who has a shared mailbox.

I'll have to deactivate it in the Active Directory, but I'd like to keep the shared mailbox.

Come on, can I do that?

If I remove the user from the on-premise Active Directory sync, the cloud user is deleted.

After deleting the cloud user, I restore it.

It seems to work, but in the sync software I get this warning: DeletingCloudOnlyObjectNotAllowed.
This error is caused by the filled-in field in the On-premises cloud user's immutable ID. How can I clear the field?

thank you

Microsoft Security | Microsoft Entra | Microsoft Entra ID
0 comments No comments

Answer accepted by question author
Vasil Michev 127.6K Reputation points MVP Volunteer Moderator
2025-10-06T17:55:17.63+00:00

Once you have restored the cloud user from the Recycle bin, you can overwrite it's ImmutableId with any other value, including null. Here's an example:

User's image

I specifically used the Graph Explorer above, as the PowerShell module has a known issue with setting null values. You can still use the Update-MgUser cmdlet to set any other value, much to the same effect for your scenario. For example:

Update-MgUser -UserId ******@domain.com -OnPremisesImmutableId "blabla"

If you must use PowerShell, try the Invoke-MgGraphRequest cmdlet instead:

Invoke-MgGraphRequest -Method PATCH -Uri "https://graph.microsoft.com/v1.0/Users/{userId}" -Body @{onPremisesImmutableId = $null} 

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.