In this article, I’ll explain how to update the EmployeeOrgData for Entra ID users, which includes the Division and CostCenter properties. These properties are typically synchronized from an on-premises Active Directory environment via Entra Connect, but you can also set them using the PowerShell Graph module. Below, I’ll provide an example of how to do this.
Updating EmployeeOrgData
The PowerShell code below first connects to Graph using the User.ReadWrite scope, which grants permission to modify user records. It then updates a user’s EmployeeOrgData collection, setting the Division and CostCenter properties to the specified values.
Afterward, it retrieves the updated properties of the same user to confirm the changes were successful, before disconnecting the session.
Connect-MgGraph -Scopes "User.ReadWrite.All"
# The Object ID or UserPrincipalName of the user to modify
$UserId = "##############"
# Update the EmployeeOrgData IMicrosoftGraphEmployeeOrgData variable type with example data
Update-MgUser -UserId $UserId -EmployeeOrgData @{
'Division' = 'Test Division';
'CostCenter' = 'Example';
}
# Retrieve the results
$UserDetails = (Get-MgUser -UserId $UserId -Property EmployeeOrgData).EmployeeOrgData
$UserDetails
Disconnect-MgGraph
Got a project that needs expert IT support?
From Linux and Microsoft Server to VMware, networking, and more, our team at CR Tech is here to help.
Get personalized support today and ensure your systems are running at peak performance or make sure that your project turns out to be a successful one!
CONTACT US NOW