Forum Discussion
pischta
May 22, 2025Copper Contributor
OnPremisesImmutableId field update
Hi,
when I update the OnPremisesImmutableId with
Update-MgUser -UserId "<user id>" -OnPremisesImmutableId '<base64 coded id>'
if it contains '/', that character doesn't stored.
Other "interesting" behavior is that
Get-MgUser -UserId "<user id>" | Select-Object OnPremisesImmutableId,UserPrincipalName
gives empty OnPremisesImmutableId field, but I can see it on the azure portal, and when I export it with
Get-MgUser -All -Property Id, UserPrincipalName, OnPremisesImmutableId | Select-Object Id, UserPrincipalName, OnPremisesImmutableId | Export-Csv -Path "UsersImmutableId.csv" -NoTypeInformation
Of course, without '/', with both method.
How can I set this field correctly?
I don't seem to have issues with that, which version of the module are you on? Make sure you enclose the value in quotes.
For the second query, that's the expected behavior, as Get-MgUser only returns a limited set of properties by default, and OnPremisesImmutableId is not one of them. You have to specifically request it.
3 Replies
Sort By
I don't seem to have issues with that, which version of the module are you on? Make sure you enclose the value in quotes.
For the second query, that's the expected behavior, as Get-MgUser only returns a limited set of properties by default, and OnPremisesImmutableId is not one of them. You have to specifically request it.
- pischtaCopper Contributor
Module version is 2.26.0. I used quotes, of course.
I upgraded to 2.28.0, and the update of the OnPremisesImmutableId works well now, thanks.
I queried the users withGet-MgUser -UserId "<UPN>" | Select-Object UserPrincipalName, OnPremisesImmutableId
Ah yes, 2.26.0/2.27.0 had some very nasty bugs... this module as a whole is terrible to a point where I prefer to make the direct Graph calls instead.