SOLVED

getting at On Premises user attributes in Powershell/Graph?

Copper Contributor

In the Entra admin center, there are many attributes on each user that start with the name 'On Premises'. I would like to extract this info for my users and report on it. The download function in the admin center does not export these attributes. I'm guessing I can get to them somewhere via graph/powershell but I have yet to find the 'on premises' fields I'm looking for. I am mostly trying to report on 'On Premises user principal name'. Does anyone know how to get at this bit of info? THX>

3 Replies
best response confirmed by Wick_man11 (Copper Contributor)
Solution
It's fairly easy to do this via Graph:

GET https://graph.microsoft.com/v1.0/users?$select=id,displayName,userPrincipalName,onPremisesExtensionA...

The corresponding SDK cmdlet is:

Get-MgUser -All -Property ID,DisplayName,UserPrincipalName,companyName,onPremisesExtensionAttributes | Select-Object ID,DisplayName,UserPrincipalName,companyName -ExpandProperty onPremisesExtensionAttributes | select *
To clarify, the above is an example of getting one such property (which happens to contain all the "extension" attributes). To retrieve any other properties, such as OnPremisesDistinguishedName or OnPremisesUserPrincipalName, add them to the "select" statement as needed.
Very useful Vasil, thank you very much.
1 best response

Accepted Solutions
best response confirmed by Wick_man11 (Copper Contributor)
Solution
It's fairly easy to do this via Graph:

GET https://graph.microsoft.com/v1.0/users?$select=id,displayName,userPrincipalName,onPremisesExtensionA...

The corresponding SDK cmdlet is:

Get-MgUser -All -Property ID,DisplayName,UserPrincipalName,companyName,onPremisesExtensionAttributes | Select-Object ID,DisplayName,UserPrincipalName,companyName -ExpandProperty onPremisesExtensionAttributes | select *

View solution in original post