Exchange Online + Exchange On Premises = Shared Namespace, How About Mail Routing?



When thinking about configuring a hybrid environment, as in moving some mailboxes online, and keeping some on premises, one the questions you need to answer is: how do you want to have your mail flow configured? Do you want your MX record to point to the Microsoft Datacenters, and configure mail routes to make sure internet mail destined for users homed On Premises are delivered, or do you want to have the MX record pointing to your local On Premises Exchange environment, and configure mail routes to assure mails are delivered to users with their mailboxes in Exchange Online.  The Exchange Deployment Assistant will provide you with the steps to follow for whatever configuration you opt:


Our environment

In our environment, we have chosen to keep our MX record pointing to our on premises environment, and thereby configuring mail flow as pictured below


Example of a message from the internet that is sent to, will be delivered to our Exchange On Premises environment. Exchange accepts the message, being responsible for the domain, and retrieves the following information about this user:


Demo.User2 is a so-called Remote Mailbox, being, a user in our on-premises Active Directory, having a mailbox in the cloud-based service, Exchange Online.

Where the RemoteRoutingAddress is the one of importance in our mail routing story, being (looking at TechNet):

The RemoteRoutingAddress parameter specifies the SMTP address of the mailbox in the service that this user is associated with.

If you've configured mail flow between the on-premises organization and the service, you don't need to specify this parameter. The remote routing address is calculated automatically

Mail is routed to Exchange Online, using the therefor configured Send Connector, with address space, and smarthost Exchange Online.

When Demo User2 replies to the mail, since it’s primary address is set to, the mail will be sent using that e-mailaddress.

How do you create these Remote Mailboxes?

After setting up your hybrid environment, following the rules given by the Exchange Deployment Assistant, you can start moving mailboxes from On Premises to Online. After moving a mailbox, the user will be converted to a RemoteMailbox automatically, and there is nothing you need to configure manually, you just need to define the Remote Domain when launching a remote move request, as you can see in the pictures below when moving the mailbox of user1 to Exchange Online:



After the move, the user will show up as a remote user mailbox in the EMC


And as a mailbox-enabled user in Exchange Online



How about a new user?

Easiest way is to use the EMC, to create that user as new Remote Mailbox.

Open the EMC, go down to Recipient Configuration, Mail Contact, and select New Remote Mailbox


Chose the type of remote resource mailbox you wish to create


Enter the required user information



Add an archive if wanted


Review the configuration summary





Remote Mailbox successfully created!


Launch dirsync and assign a license to the newly created user



And that’s it, demo user3 can sign in, using his on premises credentials, and open his online mailbox Smile

How about an existing user?

If you already have created a user in Active Directory, and the user has already been sync’ed to online (or not), you can give that user a mailbox in Exchange Online, by using the Exchange Management Shell cmdlet Enable-RemoteMailbox, as shown below where demo user 4 gets a mailbox in Exchange Online:


And this is seen online


One happy demo user 4 Smile

Be Careful: What happens if you would simply use the Exchange Online Management tools, like the Shell to mailbox-enable a sync’ed user, and give that user mailbox in Exchange Online?

The mailbox-enabled user will be able to send messages outbound, BUT won’t be able to receive messages from the internet or from an On-Premises homed mailbox, since the Exchange server On Premises doesn’t know anything about this user…messages will be queued, and an NDR will be sent back after (by default 2 days)… Let’s have a look at an example here…

After creating a user, Dummy Test, On Premises, and running DirSync, we have the following:

* On Premises Exchange shows:


* Online Portal shows


* Let’s enable Dummy Test for Exchange


* Connecting to Exchange Online using Remote PowerShell, reveals:


* sending messages outbound works fine, but whenever someone replies to a mail from the internet or from an On Premises mailbox, the messages are not delivered, and queued on the On Premises Hub Transport server:


Solution? Yes, run Enable-RemoteMailbox, force Directory Synchronization, and all good Smile

On Premises:





Mail flow ok: