Special characters in UPN and email addresses in Office 365 migrations

This is a workaround in order to migrate mailboxes to Office 365 which have special characters.

You may run into an issue migrating from on premise Exchange to Office 365, where some accounts fail due to illegal characters in email addresses or UPNs. Having spoken to Microsoft about this, the official line is that no special characters are supported, therefore you should remove them if at all possible. However, we found during a large migration that in some cases they can be retained.

Note that the Microsoft article linked below does not mention UPNs, however we found that special characters in UPNs will cause users and shared mailbox migrations to fail.

The result of our testing was as follows:

  • Distribution Lists don’t require any changes and will still work
  • User accounts and shared mailboxes need any illegal characters removing from UPN, mail and primary SMTP address in proxyaddresses attribute, but these can be added back in as SMTP aliases, and should then be retained once the account is migrated.

Note: I would suggest that special characters are simply removed, rather than replaced with anything else. There are different types of characters, so removing them works for anything. It is not required to change the Display Name in the GAL, only the email address and whilst that is what people will see if they reply to an email, and they will still receive emails on the old address. This will be very difficult to manage if we have different rules for different areas of the business, different characters etc.

You can follow the process below to make changes to affected accounts in your on premise Active Directory before they can be migrated. To be clear, the process is as follows (for users and shared mailboxes):

  1. Remove any special characters from UPN, mail, and primary SMTP address
  2. Add back the primary SMTP address as an alias (if still required)
  3. All other aliases and attributes can remain as-is, including display name.


Display name: R&D Team Mailbox – leave as-is

UPN: Change R&DTeamMailbox to RDTeamMailbox

Change Primary SMTP: From R&DTeamMailbox.com to RDTeamMailbox@domain.com (remove &)

Add back the primary address as an alias: R&DTeamMailbox.com

Note that the full list of special characters is as below, from https://support.microsoft.com/en-us/help/2001616/a-user-s-office-365-email-address-unexpectedly-contains-an-underscore


space character
` apostrophe
( opening parenthesis
) closing parenthesis
single quotation mark
& ampersand
\ pipe
= equal sign
? question mark
/ forward slash
% percent

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.