New-Remote Mailbox Proxy Email/Route Address issue


Hi all,

Odd issue I’ve been dealing with that is sending me crazy. here is our config:

* E3 Subscription
* Exchange 2010 Hybrid
* ADSync with AADConnect
* User mailboxes hosted on 365 Exchange

When creating a new user we are using the New-RemoteMailbox method. This creates the user mailbox on 365, creates the user on our local AD, then syncs the ADs.

User creation part works fine. Remote mailbox is reated fine. The problem is with the aliases/proxy and routing address. When the remote mailbox is created, it makes the routing address – username@company.mail.onmicrosoft.com and correct alias – username@company.com. But when the user appears in 365, it only has username@companyname.com (eventually the onmicrosoft.com email alias shows)

As per MS description of what new-remotemailbox should do:

>[https://docs.microsoft.com/en-us/powershell/module/exchange/federation-and-hybrid/new-remotemailbox?…](https://docs.microsoft.com/en-us/powershell/module/exchange/federation-and-hybrid/new-remotemailbox?view=exchange-ps)
>
>”Use the New-RemoteMailbox cmdlet to create a mail user in the on-premises Active Directory and also create an associated mailbox in the cloud-based service.

>
>New-RemoteMailbox cmdlet **automatically calculates the SMTP address of the mailbox** to be used with the RemoteRoutingAddress parameter. ”

​

The part of my script that call new-remotemailbox is as follows

​

`New-RemoteMailbox -Name $fullname -FirstName $firstname -LastName $lastname -DisplayName $fullname -SamAccountName $logonname -UserPrincipalName $logonname@$domain -PrimarySmtpAddress $logonname@companyname -Password $password -OnPremisesOrganizationalUnit $OU`

​

The problem I have is that is either calculating the wrong address, or not generating the correct proxy/alias address on the users 365 existence.

​

[Exchange 2010](https://i.redd.it/rsthe1x9t2q11.png)

​

[Exchange online](https://i.redd.it/tyng66ybt2q11.png)

​

​

[MS 365 Admin Center](https://i.redd.it/a0r2budgt2q11.png)

​

Has anyone else come across this? Or am I missing something really simple



View Reddit by wookiegtbView Source

2 thoughts on “New-Remote Mailbox Proxy Email/Route Address issue

  1. atguilmette says:

    I’m not sure I really see an issue? How are you generating $logonname? It would appear that you’re doing something like $firstname + “.” + $lastname? In Exchange, when you generate a sAMAccountName, the value that you use for it is automatically used for alias (as long as it comports with our rules).

    When you run the HCW, the EAP targeting all hybrid domains are modified to stamp users according to the following template: %m@tenant.mail.onmicrosoft.com. %m is the shorthand for “alias.”

    Based on the limited information I see, it looks like it’s working exactly as designed. Since it appears that you’re building $logonname from $firstname.$lastname, that’s the value that’s going to get used for alias.

    It honestly doesn’t really even matter what the tenant routing address is, so long as it’s stamped on your user. You could create a user named [Bob.Smith@domain.com](mailto:Bob.Smith@domain.com) with an alias of bobsmith and give him a tenant / remote routing address of [yourmonkeysuncle@tenant.mail.onmicrosoft.com](mailto:yourmonkeysuncle@tenant.mail.onmicrosoft.com). As long as the value stamped in targetAddress (AD) / RemoteRoutingAddress (exchange) matches the value that’s in user’s proxyAddresses array, the mail will get delivered fine.

Leave a Reply

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