How to download azure AD users' missing properties

InfraSolutions 711 Reputation points
2023-03-28T16:31:06.6366667+00:00

Dear Support,

I'm trying to download all users from Azure AD using the "Download users" option,

User's image

& received the following default property values from CSV file,

1.
userPrincipalName

  1. displayName
  2. surname
  3. mail
  4. givenName
  5. id
  6. userType
  7. jobTitle
  8. department
  9. accountEnabled
  10. usageLocation
  11. streetAddress
  12. state
  13. country
  14. officeLocation
  15. city
  16. postalCode
  17. telephoneNumber
  18. mobilePhone
  19. alternateEmailAddress
  20. ageGroup
  21. consentProvidedForMinor
  22. legalAgeGroupClassification
  23. companyName
  24. creationType
  25. directorySynced
  26. invitationState
  27. identityIssuer
  28. createdDateTime

I need to export a few missing property values for all users from Azure AD. i.e.,

Manager

Employee ID

Employee type

Employee hire date

Could you please assist how I may export the missing list?

Windows for business | Windows Client for IT Pros | Directory services | Active Directory
Microsoft Security | Active Directory Federation Services
Microsoft Security | Microsoft Entra | Microsoft Entra External ID
Microsoft Security | Microsoft Entra | Microsoft Entra ID
Microsoft Security | Microsoft Entra | Other
{count} votes

Accepted answer
  1. Michael Durkan 12,241 Reputation points MVP
    2023-03-28T18:51:14.0733333+00:00

    Hi

    see the link below which includes PowerShell script to do this:

    https://stackoverflow.com/questions/72121885/azuread-full-roster-report-with-employee-id-and-manager

    #Connect to Azure AD
    #For more info - https://learn.microsoft.com/en-us/powershell/azure/active-directory/install-adv2?view=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
    

    Hope this helps,

    Thanks

    Michael Durkan

    • If the reply was helpful please upvote and/or accept as answer as this helps others in the community with similar questions. Thanks!

1 additional answer

Sort by: Most helpful
  1. InfraSolutions 711 Reputation points
    2023-03-30T15:44:38.44+00:00

    Thank you for providing the powershell script. The script is working correctly. Could you help explain how to extract the missing list from this script?

    i.e.,

    I found the attribute name "manager" in on-premise AD and added the following property, but I'm getting a blank report,

    "Manager" = $azuser.manager

    User's image

    Note:

    I got the result from the parameter below, but I just received the email address in place of the user name,

    "Manager Email" = (Get-AzureADUserManager -ObjectId $azuser.ObjectId).UserPrincipalName

    0 comments No comments

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.