change the User ID that is being used to login to Office 365

I need to change the User ID that is being used to login to Office 365.  We have an on site Exchange 2010 server and have migrated to Office 365.  Our current domain and email address is and Microsoft created us a domain called  My users really have two email addresses, and  This is fine and we are using AD synchronization which is working fine.  

However, it makes my users log into their accounts with the account when accessing email or 365 in the cloud.  But at work in our domain, they are accustomed to using  Is their a way I can make it allow them to login with the other account id instead of the one Microsoft created?

Lanee KirbyAsked:
Who is Participating?
Vasil Michev (MVP)Connect With a Mentor Commented:
Do you "own" the domain and have you verified it in O365? If you need help with the process, read here:

Once that is done, you can use the domain to assign UPNs/EmailAddresses to the users, so they can match across on-premises and O365. To change the UPN, you can use the Set-MsolUserPrincipalName cmdlet:
Todd NelsonSystems EngineerCommented:
Do you have the domain added to O365, and if not, can you add it?
Lanee KirbyAuthor Commented:
We do own the domain and I have added it O365 and it is listed as the (default) domain.  However, we have always (about a year now) had to login to O365 with our login account name.  I read articles about what your suggestion is supposed to do.  Help me understand please.  In my User profile account in AD on site, their User profile name is User @ (long, long ago, when my domain was created, the person put the name local in it).  In their AD profile it lists their email address as

In O365, it lists both addresses, and  It lists as the primary but it lists the User profile as User @

Question is The powershell command is supposed to change the User ID in O365, not locally in my AD, since it is already correct?  I cannot manually change it in O365 even though their is a drop down box.

Thanks for any clarification.

Vasil Michev (MVP)Commented:
Email addresses dont matter here, only the UserPrincipalName. You can change it in O365 directly, via the PowerShell cmdlet I linked above.

The on-premises and O365 UPNs dont need to match, although it's a good practice to keep them in sync.
Lanee KirbyAuthor Commented:
Thank you for your assistance.  The command Set-MsolUserPrincipalName did not make the necessary changes that I needed.  It actually failed saying it did not know what that parameter meant.  
However, upon searching some more, I found this command that did exactly what I needed.
Set-Mailbox "" -MicrosoftOnlineServicesID ""
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.