Thursday, January 24, 2013

How to change the username in Office 365

I had a problem recently while doing a Staged Migration from Exchange 2007 to Microsoft Office 365. At the on-premises site, the Active Directory had a setup as follows:
  • User first name: First (eg Joe)
  • User last name: Last (eg Bloggs)
  • User login name: firstl (eg joeb)
  • User primary email: flast@mydomain.com (eg jbloggs@myuni.edu.au)
The problem was, when user accounts were migrated to Office 365, sometimes the UPN (User Principal Name) came across as flast@mydomain.com, other times as firstl@mydomain.com. This was a bit confusing for users to have a username which looked like an email address (firstl@mydomain.com) but was different to their usual email address (flast@mydomain.com). Not only that, there was a hiccup with one user who got the default onmicrosoft.com domain for their primary email address (eg firstl@mydomain.onmicrosoft.com). It would be much better if all user accounts consistently used flast@mydomain.com for both username and primary email address.

How to change the UPN?

So how did I change the UPN for those users to be the same as their primary email address? In the end I used PowerShell for Microsoft Online, and these are the steps I followed:
  1. Installed Microsoft Online Services Sign-In Assistant (IDCRL7) - 64 bit version
  2. Installed Microsoft Online Services Module for Windows PowerShell (64-bit version)
  3. Clicked the Microsoft Online Services Module shortcut to open a Windows PowerShell workspace
  4. Ran "connect-MSOLService" to connect to Microsoft Online (and entered username and password for Office 365 administrator account)
  5. Ran "Set-MsolUserPrincipalName -UserPrincipalName firstl@mydomain.com -NewUserPrincipalName flast@mydomain.com"
These are the references I used to get to this result:

How to change the primary email address?

How about the account which had the wrong primary email address? For this one I needed to change the Proxy Addresses for the account, and because the Office 365 users were still synchronized with the on-premises Active Directory, I had to use ADSIEdit.msc to change the proxyAddresses attribute for that account, specifying SMTP in all-caps, for the address I wanted to use as the primary email address. I followed the instructions I found in Step 4 of the Solution in the following Microsoft KB article: http://support.microsoft.com/kb/2492140.

Here is a copy of the main steps from that KB article:
Use Active Directory Service Interfaces (ADSI) Edit to edit the proxyAddresses attribute of the user object so that it matches the primary SMTP address that you noted in step 1D. To do this, follow these steps:
  1. Click Start, click Run, type ADSIEdit.msc, and then click OK.
  2. Right-click ADSI Edit, select Connect to, and then click OK to load the domain partition.
  3. In the navigation pane, locate the user object that you want to change, right-click it, and then click Properties.
  4. In the Attributes list, click the proxyAddresses attribute, and then click Edit.
  5. In the Value to add field, enter the appropriate SMTP address, and then click Add.
Note The primary SMTP address value for the user object should be prepended by an uppercase "SMTP:" designator for the address value to be formatted correctly for the proxyAddresses attribute. For example, "SMTP:username@contoso.com" is an acceptable value, and "username@contoso.com" isn't an acceptable value. f.Click OK two times, and then exit ADSI Edit.
(It was this forum discussion that helped me get to the answer: http://community.office365.com/en-us/forums/158/t/44701.aspx)

No comments:

Post a Comment