Unable to get the values of OnPremises* attributes for the user in Entra ID via MS Graph PS module

Allan Stark 541 Reputation points
2025-03-14T12:40:38.4733333+00:00

Hello,

MS decommissions old PS MSOnline and AzureAD modules and recommends to use Microsoft.Graph instead.

I was unable to get the values ​​of these attributes using something like:

Get-MgUser -UserId "******@company.com" | Format-List *

it shows these attributes as empty.
Updating these attributes with

Update-MgUser -UserId "******@company.com" -OnPremisesImmutableId "$null"

also has no effect.

At the same these attributes still manageble and visible by old PS modules and in Entra Admin Center.

What am I doing wrong?1

2

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
13,517 questions
0 comments No comments
{count} votes

Accepted answer
  1. Vasil Michev 117.1K Reputation points MVP
    2025-03-14T18:06:10.9833333+00:00

    The Get-MgUser cmdlet does not return all properties by default, you have to specifically request them. For example, this will return all user's with the corresponding onPremisesImmutableId value:

    Get-MgUser -All -Property id,onPremisesImmutableId | select Id,onPremisesImmutableId
    

    The downside is that you need to list each individual property you want returned. Using the "beta" module cmdlets, such as Get-MgBetaUser does return most properties by default. But there are still some that will only be returned if you specifically request them.

    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 Answers by the question author, which helps users to know the answer solved the author's problem.