Changing a user's login name or email address

Clicking the Edit link to the right of a user's login name will open a dialog that allows you to change their username, add email aliases, and replace the username with any existing alias. To change the login name, simply create a new alias and then use the Set as primary button to replace the user's login name with the newly created email alias:

Changing a username and aliases

While there's no bulk option to change user login names, there is a bulk option to change their login domain, which can be useful in cases where you added users with the *.onmicrosoft.com domain and need to change them over to a company domain later.

Note the following warnings, which are provided when you change users' login domains. They also apply equally if you change a user's login name:

  • If they have Exchange, and their email addresses are the same as their usernames, the email addresses will also be changed
  • If this user has Skype for Business, they'll need to reschedule any Skype for Business meetings they organized and tell external contacts to update the contact information for them
  • This user will also need to update their username in any apps they use, such as Outlook, OneDrive, and any mobile apps

That last one is possibly the most important one:

Bulk setting login domain

To change a user's login name, use the special Set-MsolUserPrincipalName command, as follows:

Get-MsolUser -UserPrincipalName jdeer@liquidhgdev.onmicrosoft.com | Set-MsolUserPrincipalName -NewUserPrincipalName jd@lab.liquidhg.com

The preceding command uses Get-MsolUser to retrieve the desired user, and then it pipes the output to Set-MsolUserPrincipalName, whereupon the -NewUserPrincipalName parameter will make changes to the login name.

For information about how to add or remove email address aliases in PowerShell, please see Chapter 4, Administering Exchange Online – Essentials.