Step 1:
Open up PowerShell and run this command to connect to the Msolservice:
Connect-MsolService
Enter your Admin O365 credentials
Step 2:
Run this command to rename a user’s user name:
Set-MsolUserPrincipalName -UserPrincipalName "[email protected]" -NewUserPrincipalName [email protected]
When done search for the user on the admin portal and you will notice the username is now changed.
This helps when you make a spelling error in the name or the user has another name that they prefer to use.