Matthew
Matthew

Reputation: 1450

Extracting specific information from AzureAD

I'm attempting to extract the "employeeID" from all users held within my AzureAD site. Currently i'm using: Get-AzureADUser -ObjectId "email" | Select-Object -ExpandProperty extensionproperty

This works and gets me the employeeID, however, it also pulls additional information

output:

Key                                                   Value                                                                          
---                                                   -----                                                                          
odata.metadata                                        https://graph.windows.net/0a138b97-aedc-4e06-875a-44803cfcd8c1/$metadata#dir...
odata.type                                            Microsoft.DirectoryServices.User                                               
createdDateTime                                       20/03/2019 10:47:23                                                            
employeeId                                            x                                                                         
onPremisesDistinguishedName                           x   
userIdentities                                        []                                                                             
extension_dfb221e9879e4fa2bd42bc4c8f90eeed_employeeID x  

My question is, how exactly do I pull JUST the employeeid information?

Upvotes: 1

Views: 537

Answers (1)

Theo
Theo

Reputation: 61068

Since the ExtensionProperty is a Dictionary object, you need to pull the EmployeeId value from that using:

(Get-AzureADUser -ObjectId "email").ExtensionProperty["employeeId"]

Upvotes: 2

Related Questions