Hello,

Sometimes you might have to change the UPN for a user that has already been synced to the cloud.
This can be due to typos during creation, a new surname or similar scenarios.

You can change the UPN in the local Active Directory but this will not sync to the cloud with DirSync.
This is due to that the UPN in Azure Active Directory is created during the first sync and it will not be changed by any future sync.

To resolve this you have to change the value manually using powershell.
You need to download and install this Microsoft Online Services Sign-In Assistant and this Azure Active Directory Module to be able to run the cmdlets you need.

First you need to import the module.

Import-Module Azure

Second you need to supply the credentials to be used to connect to Azure AD.

$msolcreds = get-credential
get-credentials

Enter the credentials in the box that pops up.

Connect to Azure AD using the credentials supplied.

connect-msolservice -credential $msolcreds

Change the UPN for the user. You have to specify the old UPN and then the new UPN.

Set-MsolUserPrincipalName -UserPrincipalName test.someone@nianit.com -NewUserPrincipalName test.somebody@nianit.com

In my example I will change the UPN for test.someone to test.somebody.
This means that I from now have to use test.somebody@nianit.com to log on to my cloud services.

I hope this helped some of you.
Post in the comments if you have any questions.

// Niclas

Leave a Reply