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.
With ManageEngine ADManager Plus, assigning or updating a user’s manager can be done directly from the tool—no scripts needed.
Before using the Set-MgUserManagerByRef cmdlet:
Install-Module Microsoft.Graph -Scope CurrentUser
Connect-MgGraph -Scopes "User.ReadWrite.All"
This cmdlet lists the groups that a specific user is a direct member of:
Set-MgUserManagerByRef -UserId <UserId> -RefObjectId <ManagerId>
Assigning a manager to a user:
Set-MgUserManagerByRef -UserId "alex@zkyy.com" -RefObjectId "roberts@zkyy.com"
| 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. |