Updating multiple user details in Azure Active Directory (AD) can be done using PowerShell scripts, Microsoft Graph API, or Azure AD Connect with a CSV file. You can run this code in the powerShell to do the needed update
- Install AzureAD PowerShell module: #Install-Module -Name AzureAD
- Connect to Azure AD as an administrator: #Connect-AzureAD
- Create a CSV file with columns containing the user details you want to update. Make sure to include at least the "UserPrincipalName" (UPN) and the attributes you want to update:
#UserPrincipalName,DisplayName,Department
#******@domain.com,New Display Name,IT
#******@domain.com,Updated User,HR
- Use this PowerShell script to read the CSV file and update user details:
$users = Import-Csv -Path "C:\path\to\users.csv"
foreach ($user in $users) {
$userPrincipalName = $user.UserPrincipalName
$displayName = $user.DisplayName
$department = $user.Department
Set-AzureADUser -ObjectId $userPrincipalName -DisplayName $displayName -Department $department
}
- Discount from the AD: #Disconnect-AzureAD