Forum Discussion

Robert Bollinger's avatar
Robert Bollinger
Iron Contributor
Apr 04, 2018

Rename users UPN, Hybrid Enviornment

Hey Team, 

 

Couple of questions here are regarding renaming a users UPN in a Hybrid Environment. I understand you can use the following command:

 

Set-MsolUserPrincipalName -UserPrincipalName dfranks@exchangetest.com -NewUserPrincipalName Dave.Franks@exchangetest.com

 

The above command would be run using powershell once you established a connection with office 365. However that command would not "update" the same users UPN in the On premise environment, so how does running that command make any sense? 

 

Isn't it just smarter to rename the Object using ADUC? Were you not previously able to use that tool to rename UPNs for Office 365 users? 

 

Thanks, 

Robert

6 Replies

  • WC_KStill's avatar
    WC_KStill
    Copper Contributor

    Robert Bollinger 

     

    Not sure if you have a solution to this yet but it took me a while.

     

    I ended up moving the user to an OU that wasn't synced.

     

    I ran AD sync

     

    This puts the user in the deleted section at admin.microsoft.com

     

    I restored it making it a cloud only account and and then I modified the username@domain.onmicrosoft.com address

     

     moved the user back to the original OU

     

    Ran Sync

     

    It fixed it

     

    Before all this I had already modified the username, mail, email, mailnickname, proxyaddresses, targetaddress, and UserPrincipalName in AD but nothing would modify the username@domain.onmicrosoft.com address.

  • You should be making the change on-premises. In case the UPN change does not get reflected in O365 (happens sometimes), then you can use the cmdlet. You can also change the UPN directly in O365, without changing it On-Prem. But as the on-premises AD is the source of authority, you risk the change getting overwritten at some point (when a Full sync cycle is invoked).

    • A_Cardullo's avatar
      A_Cardullo
      Copper Contributor

      Whats the easiest way to first change the UPN name  on the Prem server.  also use PS?

       

  • Because when you change a UPN on prem, it doesn't get changed via the sync. So you have to update via powershell command so it updates on the 365 side.
    • Robert Bollinger's avatar
      Robert Bollinger
      Iron Contributor
      Ok so is the correct process to rename the user account in AD and then run the command for the office 365 side ?

      Robert
      • Deleted's avatar
        Deleted
        That’s how I do it, probably can be done either way, but if you do it onprem, don’t forget to update alias as well for exchange so you get a matching e-mail address with the UPN if that wasn’t already done 😝.

Resources