Enable remote mailbox in a Hybrid config Office with 365

To enable a remote mailbox and still be able to migrate it between onpremises and office 365 you have to do the following steps :

Open a remote PowerShell connection to Office 365:

$UserCredential = Get-Credential

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection

Import-PSSession $Session

And run the following command :

Get-Mailbox UPN | fl ExchangeGuid

You should now get the ExchangeGuid copy this because you are going to need this later.
Open the Exchange Management Shell on-premises Exchange ServerĀ and run the following cmdlets:

Enable-RemoteMailbox UPN -RemoteRoutingAddress Username@domain.mail.onmicrosoft.com

Set-RemoteMailbox UPN -ExchangeGuid ExchangeGuid