Forums on Intune, SCCM, and Windows 11

Welcome to the forums. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your topics and posts, as well as connect with other members through your own private inbox!

SOLVED How to download Azure AD Users and the following properties

MJ-Tech

Well-Known Member
Messages
217
Solutions
25
Reaction score
21
Points
18
Dear Support,

I can export Azure AD users through the Azure portal or using a powershell script, but the exported CSV file only provides a few properties. Is it possible to export the values for the properties listed below from any location?

  • Manager​
  • Employee ID
  • Employee type
  • Employee hire date
Note: I added the following line to the powershell script, however I received an empty report. "Manager" = $azuser.manager


Option :1 Azure Portal
User's image

Option :2 : Powershell script

#Connect to Azure AD #For more info - https://learn.microsoft.com/en-us/p...=azureadps-2.0#installing-the-azure-ad-module #Install-Module AzureAD Connect-AzureAD #Path sets the Output location of the CSV file. param( [string] $path = "C:\Users\<userName>\Desktop\ADUsers-$(Get-Date -format "MM-dd-yyyy").csv" ) #For Each will get all Enabled Azure AD Users and the following properties: #Employee ID, First Name, Last Name, Work Email, Job Title, Department, Management Email, License & { foreach($azuser in Get-AzureADUser -All $true -Filter 'accountEnabled eq true') { [pscustomobject]@{ "Employee ID" = $azuser.ExtensionProperty["employeeId"] "First Name" = $azuser.givenName "Last Name" = $azuser.surname "Work Email" = $azuser.UserPrincipalName "Job Title" = $azuser.JobTitle "Department" = $azuser.CompanyName "Manager Email" = (Get-AzureADUserManager -ObjectId $azuser.ObjectId).UserPrincipalName "License" = $azuser.ExtensionProperty["extension_a92a_msDS_cloudExtensionAttribute1"] } } } | Export-CSV -Path $path -NoTypeInformation


Output: Default properties value,

  1. userPrincipalName
  2. displayName
  3. surname
  4. mail
  5. givenName
  6. id
  7. userType
  8. jobTitle
  9. department
  10. accountEnabled
  11. usageLocation
  12. streetAddress
  13. state
  14. country
  15. officeLocation
  16. city
  17. postalCode
  18. telephoneNumber
  19. mobilePhone
  20. alternateEmailAddress
  21. ageGroup
  22. consentProvidedForMinor
  23. legalAgeGroupClassification
  24. companyName
  25. creationType
  26. directorySynced
  27. invitationState
  28. identityIssuer
  29. createdDateTime
 
#Connect to Azure AD #For more info - https://learn.microsoft.com/en-us/p...=azureadps-2.0#installing-the-azure-ad-module #Install-Module AzureAD Connect-AzureAD #Path sets the Output location of the CSV file. param( [string] $path = "C:\Users\<userName>\Desktop\ADUsers-$(Get-Date -format "MM-dd-yyyy").csv" ) #For Each will get all Enabled Azure AD Users and the following properties: #Employee ID, First Name, Last Name, Work Email, Job Title, Department, Management Email, License & { foreach($azuser in Get-AzureADUser -All $true -Filter 'accountEnabled eq true') { [pscustomobject]@{ "Employee ID" = $azuser.ExtensionProperty["employeeId"] "First Name" = $azuser.givenName "Last Name" = $azuser.surname "Work Email" = $azuser.UserPrincipalName "Job Title" = $azuser.JobTitle "Department" = $azuser.CompanyName "Manager Email" = (Get-AzureADUserManager -ObjectId $azuser.ObjectId).UserPrincipalName "License" = $azuser.ExtensionProperty["extension_a92a_msDS_cloudExtensionAttribute1"] } } } | Export-CSV -Path $path -NoTypeInformation
 

Forum statistics

Threads
7,043
Messages
27,535
Members
17,730
Latest member
betablocka

Trending content

Back
Top