6

I'm trying to change the user principal name on my Azure AD user using a PowerShell command Set-MsolUserPrincipalName that I found in the Microsoft documentation here. This works fine and changes the user principal name, but it also changes the email property to the same value as well.

Example command:

Set-MsolUserPrincipalName -UserPrincipalName "davidc@contoso.com" -NewUserPrincipalName "davidchew@contoso.com"

Is there another way to change the user principal name without affecting the email of the user?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Marijan Brezovic
  • 111
  • 1
  • 1
  • 5
  • 1
    This would explain why not to do this: https://support.cloudhq.net/it-admin-office-365-why-your-user-principal-name-upn-should-match-your-email-address/ – I.T Delinquent Jun 06 '19 at 08:22
  • I know that i should not do it, but i have to recreate it on a test account to try and solve a bug that users with different emails and UPN are experiencing on our app. – Marijan Brezovic Jun 06 '19 at 09:32

2 Answers2

3

There is no way to change the user principal name without affecting the email of the user. The mail property is read-only, and the principal name should map to the user's email name.

Enter image description here

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Tony Ju
  • 14,891
  • 3
  • 17
  • 31
  • 2
    It seems [this](https://support.cloudhq.net/it-admin-office-365-why-your-user-principal-name-upn-should-match-your-email-address/) article explains that it is possible, just not how to do it. Also we have users log in on our app with emails that differ from their UPN. – Marijan Brezovic Jun 06 '19 at 09:37
  • @MarijanBrezovic The email won't change if the user is a guest. – Tony Ju Jun 06 '19 at 09:42
  • Unfortunately i need to do it for normal users that have a office 365 licence. – Marijan Brezovic Jun 06 '19 at 09:57
  • 1
    @MarijanBrezovic I have confirmed this with Azure support engineer, there is no way to change user principal name without affecting the email of the user. Hope it helps. – Tony Ju Jun 18 '19 at 07:36
  • Why don't you just add an alias for the 'old' email? – Awinad Nov 10 '19 at 21:32
1

It is now possible to change the user principal name in Azure AD without changing the email for the user and without changing the on-premises user principal name. It appears they are both managed separately now. At the time of my writing this, you can pull up the user in Azure AD and Edit the properties and go to the Identity tab where you will see user principal name and under the On-premises tab there is a separate non-editable user principal name which remains unaffected when making changes to the other.

Bill Christo
  • 1,223
  • 9
  • 8