How To Change UPN in Azure AD with PowerShell
User Principal Names (UPNs) are unique identifiers assigned to each user account in Azure Active Directory. Each user account is associated with a UPN value. You can use a UPN to identify a specific user account in any Azure Active Directory application.
You need to change UPN for Users in Azure Active Directory in certain cases. You can do this task in the admin portal or Azure AD portal or using PowerShell scripts which are efficient and help you to make changes for bulk users.
Change UPN for Single User with PowerShell
Set-MsolUserPrincipalName -UserPrincipalName John@domainabc.com -NewUserPrincipalName John@domainxyz.com
Change UPN for bulk Users with PowerShell
Create a csv file with following format.
Then run the following script to change UPN for all the users.
$users = Import-Csv “C:\Path to csv file\file.csv”
foreach ($user in $users)
Set-MsolUserPrincipalName -UserPrincipalName $user.oldupn -NewUserPrincipalName $user.newupn