Forum Discussion
Wick_man11
Jul 13, 2023Copper Contributor
getting at On Premises user attributes in Powershell/Graph?
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>
- It's fairly easy to do this via Graph:
GET https://graph.microsoft.com/v1.0/users?$select=id,displayName,userPrincipalName,onPremisesExtensionAttributes
The corresponding SDK cmdlet is:
Get-MgUser -All -Property ID,DisplayName,UserPrincipalName,companyName,onPremisesExtensionAttributes | Select-Object ID,DisplayName,UserPrincipalName,companyName -ExpandProperty onPremisesExtensionAttributes | select *
3 Replies
Sort By
- It's fairly easy to do this via Graph:
GET https://graph.microsoft.com/v1.0/users?$select=id,displayName,userPrincipalName,onPremisesExtensionAttributes
The corresponding SDK cmdlet is:
Get-MgUser -All -Property ID,DisplayName,UserPrincipalName,companyName,onPremisesExtensionAttributes | Select-Object ID,DisplayName,UserPrincipalName,companyName -ExpandProperty onPremisesExtensionAttributes | select *- bhvorstCopper ContributorVery useful Vasil, thank you very much.
- 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.