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 -NewUserPrincipalName

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


Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More