How to change the primary SMTP address of an Exchange Online mailbox in a Hybrid environment

Edit:  I’ve posted a video of this here

In a hybrid environment, when a mailbox is migrated from on-premise to Exchange online, it will retain its primary SMTP email address.  But what about when you create a new user who has never had a mailbox on-premise?

When you assign an Office 365 license, and a mailbox is created, you might find that the primary email address is set to the Microsoft Online Email Routing Address (e.g. domain.onmicrosoft.com).

Further, if you try to modify the primary email address you may get the following error

PrimarySMTP-1

In a Hybrid environment, your active directory is synced with Office 365 using Azure Active Directory Sync tool (DirSync).  Therefore your on-premise active directory is the authority and you need to manage the attributes of the user accounts from your on-premise active directory, not Office 365.

There are two ways to change the users primary email address:

(1) Use Active Directory Users and Computers (ADUC) to update the “E-mail” attribute on the properties of the user account

PrimarySMTP-2

(2) Use ADSIEdit to modify the “proxyaddresses” attribute of the user account

  • Go to Start > Run and type adsiedit.msc
  • Find the user account > Properties
  • Edit the proxyAddresses attribute
  • Add primary email address in this format
    • SMTP:emailaddress@example.com (uppercase SMTP)
  • Add secondary email addresses in this format
    • smtp:emailaddress@example.com (lowercase SMTP)

PrimarySMTP-3

Whichever method you use, don’t forget to force a sync with Office365, as Jaap Wesselius expertly describes here

7 thoughts on “How to change the primary SMTP address of an Exchange Online mailbox in a Hybrid environment

  1. I was facing a problem where new mailboxes were created with the correct email address, pulled from the mail attribute (step 1 above), but would change to the @.onmicrosoft.com address at a later date (usually the next day but sometimes later or even that same day). I submitted a ticket with Microsoft support, and they indicate the only way to ensure it is created correctly is using the second method (either adsiedit or the Attribute Editor tab in ADUC which is slightly less cumbersome than adsiedit).

  2. I have the exact same problem but changing the proxy address attribute and running a dir sycn still dosn’t change the onmicrosoft.com on 365. This one account has caused me so much frustration and the new user still cant use her mail – makes me look real bad 🙁

    • Hi Howard, check AAD Connect (Dirsync) tool for any errors. While you have changed the proxy address attribute, there may be another issue with that account preventing it from being synchronised.

  3. What I found easier is to remove the license, change SMTP and smtp using ADSI Edit, let it sync (ideally overnight / or use AD Sync).

    Re-add the license,
    Wait for the Sync – this time primary is @domain.com and secondary is onmicrosoft.com

  4. Will changing the primary email address also change the user name the individual will use to log in? Or with the login info remain the same?

Leave a Reply

Your email address will not be published. Required fields are marked *