Share via

Bulk update users manager

Jay Croyle 20 Reputation points
2023-08-30T03:45:15.0966667+00:00

I want to do bulk user updates in Azure AD. For example: all users with a Job Title of "Pennsylvania Minister" update their Manager from "Person A to Person B".

Microsoft Security | Microsoft Entra | Microsoft Entra ID

Answer accepted by question author

  1. Michael Smith 2,931 Reputation points Microsoft Employee Moderator
    2023-08-30T10:14:58.3166667+00:00

    Hi @Jay Croyle ,

    Thank you for contacting the Community forums.

    To update users managers in bulk based on the job title you can use the following script. Please ensure you updated the object id of the manager in the script.

    Connect-AzureAD 
    
    $managerID = "xxxxxxxxxxxxxxxxxxx"
    
    
    $users = Get-AzureADUser -Filter "JobTitle eq 'Pennsylvania Minister'"
    
    foreach ($user in $users) {
        Set-AzureADUserManager -ObjectId $user.ObjectId -RefObjectId $managerID
    }
    
    
    

    Please don’t forget to "Accept the answer" and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.