Change Office 365 Synced User’s UPN

During one Office 365 tenant-to-tenant migration I was doing, I needed to remove all references of the vanity domain from the source tenant before being able to remove the domain to then add it to the destination tenant.

No matter what I tried, I couldn’t get one AD-synced user’s UPN to no longer include the vanity name. Changing their UPN in AD to the .local and running a “Start-ADSyncSyncCycle” didn’t change their 365 UPN to the onmicrosoft.com UPN as expected.

I ended up fixing it by running the Set-MsolUserPrincipalName command.

In our example, we want to change jsmith’s account name from [email protected] to [email protected]

First, change their UPN in AD to a non-syncing UPN (for example, acme.local or whatever their internal domain name is).

Then, run this command:

Set-MsolUserPrincipalName -UserPrincipalName "[email protected]" -NewUserPrincipalName "[email protected]"

Obviously, the UPN you’re changing it to needs to exist in the tenant. So, change it to either its onmicrosoft.com UPN or to a vanity domain that is present in the tenant.

After that – you’re done! The user now how the correct UPN and in our example we’ll now be able to remove the domain. Read my article here on how to remove domains quickly and easily via PowerShell.

Leave a Reply

Your email address will not be published. Required fields are marked *