Download All users with Employee ID included

Antonio Alexander Pereira 0 Reputation points
2023-02-28T15:52:08.2466667+00:00

I require the Exports of the Employee ID's of my Entire 90k+ user organization included with the "download users" function in Azure AD.
However the Defaults user download does not include the employeeID - as shown in this link which I am Always being referred to: https://learn.microsoft.com/en-us/azure/active-directory/enterprise-users/users-bulk-download#:%7E:text=Navigate%20to%20Azure%20Active%20Directory,file%20listing%20user%20profile%20properties.

Is there a way to Export all users including the Employee ID?

Thank You

Microsoft Security | Microsoft Entra | Microsoft Entra ID
{count} votes

2 answers

Sort by: Most helpful
  1. Michael Durkan 12,241 Reputation points MVP
    2023-02-28T16:04:32.9533333+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

    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!
    0 comments No comments

  2. JamesTran-MSFT 36,911 Reputation points Microsoft Employee Moderator
    2023-03-02T00:14:46.68+00:00

    @Antonio Alexander Pereira

    Thank you for your post and I apologize for the delayed response!

    From your issue, I understand that you're trying to export/download a list of users from Azure AD to include Employee ID's but you're running into issues with the download not including the Employee ID field. To hopefully point you in the right direction, you should be able to run the following PowerShell script in order to download all your Azure AD users to include their Employee ID.

    #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
    
    

    For more info - AzureAD Full Roster Report with Employee ID and Manager


    If you'd like to change the user properties that're downloaded, you can run the following to get Azure AD user properties.

    #Get a list of 5 Azure AD Users
    Get-AzureADUser -Top 5
    
    #From the list of 5 users - Get a single Azure AD User by Object ID
    Get-AzureADUser -ObjectId "<ObjectID>" | Format-List
    
    
    #Add the properties needed to the PowerShell script, for example you can add UserType to the list of properties downloaded.
    
                "Employee ID"   = $azuser.ExtensionProperty["employeeId"]
                "First Name"    = $azuser.givenName
                "Last Name"     = $azuser.surname
                "Work Email"    = $azuser.UserPrincipalName
                "Job Title"     = $azuser.JobTitle
                "Department"    = $azuser.CompanyName
                "UserType"      = $azuser.UserType
    

    I hope this helps!


    If you have any other questions, please let me know. Thank you for your time and patience throughout this issue.


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.