Changing a user’s logon name in Office 365

So imagine a situation where you have Office 365 and you synchronise your on premise Active Directory with Office 365 via DirSync or Windows Azure Active Directory Sync Tool to give its full name. One day an employee comes to you and informs you of their name change which you duly change in your on premise active directory and either wait for a sync to occur or trigger on manually. Then you find out that the users logon name in Office 365 hasn’t changed so they are still logging in with their old logon name or worse they cannot access their mailbox.

This is because the UserPrincipalName is one of only a few AD attributes that isn’t synchronised back. See here for what is

You can sort this with a bit of PowerShell though. Make sure you have already installed the Microsoft Online Services Module for PowerShell you can connect to your Office 365 tenant via PowerShell using the commands:

Open up an Administrative PowerShell session and type the command:

This will prompt you for credentials and in the box you should enter the credentials of a Global Admin for your Office 365 tenant.

Next type the following command which will initiate the connection for you, if there is no error and it just goes to the next line you know your connected successfully.

Then you can change their logon name with the following command:

Comments are closed.