How to set the manager for a Microsoft Entra ID user using the Set-MgUserManagerByRef cmdlet

Assigning managers for Microsoft Entra ID users

Assigning managers to Microsoft Entra ID users is crucial for organizational structure, reporting workflows, and delegation. The Set-MgUserManagerByRef cmdlet in Microsoft Graph PowerShell allows admins to update a user’s manager, replacing the legacy Set-AzureADUserManager command. However, PowerShell-based configuration requires familiarity with scripting and proper permissions, which can slow down routine administrative tasks.

  • ADManager Plus
  • PowerShell
 

Setting managers using ADManager Plus

With ManageEngine ADManager Plus, assigning or updating a user’s manager can be done directly from the tool—no scripts needed.

  1. Log in to ADManager Plus.
  2. Navigate to Microsoft 365 > Management > User Management.
  3. Under Bulk User Modification, click Set Manager.
  4. Choose the manager, desired Microsoft 365 tenant, and user(s).
  5. Click Apply.
Assign manager to Microsoft 365 users using ADManager Plus

Set-MgUserManagerByRef cmdlet in Microsoft Graph PowerShell

Prerequisites

Before using the Set-MgUserManagerByRef cmdlet:

  • Ensure the Microsoft Graph PowerShell module is installed. If not, install it using this script:
    Install-Module Microsoft.Graph -Scope CurrentUser
  • Connect to Microsoft Graph PowerShell with the User.ReadWrite.All permission to modify users.
    Connect-MgGraph -Scopes "User.ReadWrite.All"

Using the Set-MgUserManagerByRef cmdlet

This cmdlet lists the groups that a specific user is a direct member of:

Set-MgUserManagerByRef -UserId <UserId> -RefObjectId <ManagerId>

Example

Assigning a manager to a user:

Set-MgUserManagerByRef -UserId "alex@zkyy.com" -RefObjectId "roberts@zkyy.com"

Supported parameters

Parameters Description
-UserId This parameter is used to specify the unique identifier of the user.
-RefObjectId This parameter is used to specify the object ID of the user to be set as the manager.

Limitations of using Graph PowerShell scripts for assigning managers

  • PowerShell-based configuration requires scripting knowledge and elevated permissions, which can slow down routine tasks.
  • Lack of a graphical user interface makes the task more complex and increases the chances of human error.
  • Generating reports on manager assignments also requires additional scripting effort, limiting visibility.

Why ADManager Plus is the better alternative

  • ADManager Plus provides a clean, intuitive interface that allows admins to assign or update managers without writing a single line of PowerShell script.
  • It supports modifying users in bulk through simple CSV imports, making large-scale changes quick and error-free.
  • Enables safe delegation of tasks to non-admin users through non-invasive delegation.
  • Admins can easily schedule user reports to continuously track manager-user relationships within the directory.

Simplify manager assignments with a few clicks

 
  • Assigning managers for Microsoft Entra ID users
  • Setting managers using ADManager Plus
  • Set-MgUserManagerByRef cmdlet in Microsoft Graph PowerShell
  • Limitations of using Graph PowerShell scripts for assigning managers
  • Why ADManager Plus is the better alternative
The one-stop solution to Active Directory Management and Reporting
Email Download Link