How to update user manager in bulk via MS Graph PowerShell or any other way than Azure AD PowerShell module as its going to be deprecated?

Vinod Survase 4,701 Reputation points
2024-03-28T09:40:11.7566667+00:00

How to update user manager in bulk via MS Graph PowerShell or any other way than Azure AD PowerShell module as its going to be deprecated?

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,491 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,027 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Vasil Michev 94,441 Reputation points MVP
    2024-03-28T18:37:49.41+00:00

    Assuming you have a CSV file with fields designating the user (UserUPN) and Manager (ManagerUPN), you can do something like this:

    Import-CSV blabla.csv | % { Set-MgUserManagerByRef -UserId $UserUPN -OdataId "https://graph.microsoft.com/v1.0/users/$ManagerUPN" }
    

    where we are using the Graph SDK for PowerShell.