Just a brief post today to outline how to change a Users Username on their Microsoft 365 account.
Why would you want to do this? There could be any number reasons, like the user has gotten married and their surname has changed, or simply that the Active Directory logon username doesn't match their primary email address.
So how do we achieve this?
We will use PowerShell to carry out this change, so open PowerShell as an administrator and carry out the following:
Logon to our M365 Tenant using our admin credentials after running the following command:
$LiveCred = Get-Credential
Once we've successfully logged on we'll create a new session:
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection
Next we'll set the execution policy using the syntax below:
Finally we can use the following syntax to change the username for our users profile. Just change firstname.lastname@example.org and email@example.com to suit your environment in the example below:
Set-MsolUserPrincipalName -UserPrincipalName "firstname.lastname@example.org" -NewUserPrincipalName "email@example.com"
This is especially handy when you're using AD Connect to replicate your on-premise Active Directory Users to M365 and their logon name does not match their email address. Your task is now complete...
If you've found this useful, you may want to sign up to our newsletter where you'll receive notices on when we post new articles and helpful "how tos". Just fill out your details below and we'll do the rest…