Does anyone have an example of a Remote Exchange Mailbox PowerShell Script that used in ISC context ?
How do you handle the RemoteRoutingAddress parameter?
Hi @baoussounda You can populate the targetAddress on-prem AD attribute via LDAP rather than use the PowerShell. In fact, you can enable a remote mailbox completely using LDAP, if you want.
@KRM7 Sorry about my last comment but what if I am using an IQ service connector to run this after script and it is suddenly skipping it?
Can we check the exact logs for this ?
There are 3 main attributes you need to consider when creating remote mailboxes and these can be set using either LDAP or PowerShell.
I will assume you are provisioning into on-prem AD and letting AADC do the sync with Entra. I will use the AD attribute name (with the equivalent PowerShell parameter):
mail (PrimarySmtpAddress): [email protected]
targetAddress (RemoteRoutingAddress): [email protected]
mailNickname (Alias): joe2
Also,
userPrincipalName (N/A): [email protected]
although this is not set using enable-remotemailbox.
When using the enable-remotemailbox powershell command, these attributes will synchronise with Entra and when an Exchange Online license is assigned to the Entra User a mailbox will be created with the folllowing addresses: SMTP:[email protected] smtp:[email protected] (UPN) smtp:[email protected] (for internal hybrid Exchange routing) smtp:[email protected] (mail nickname at default tenant domain)
These attributes can be set using the AD connector attribute sync based on your own requirements and then the PowerShell triggered by an After operation doesn’t need to pass those parameters.
Yes, it is needed for hybrid. You need the SMTP: prefix if you set the targetAddress with the LDAP connector. If, on the other hand, you use the enable-remoteMailbox command with the RemoteRoutingAddress parameter it doesn’t need the prefix, as PowerShell will add it.
Hi Krishna - I note in your script you are using UPN as RemoteRoutingAddress. I would suggest that in most cases the UPN wouldn’t be suitable as MS recommend the UPN to be a primary email address, not an internal routing address.
@j_place i’m able to push targetAddress on Active Directory.
But based on my customer requirement :
" It must not be set directly.
For a standard user, IDNow must create the Exchange Online mailbox using the “Enable-RemoteMailbox” command with the appropriate parameters, including “[-RemoteRoutingAddress ]” (SMTP:[email protected]).
This will also define the TargetAddress field for the user."
I dont know i pushing only target addresse will enable mailbox automatically ?
You still need to run enable-remotemailbox but if you set attributes first you don’t need to pass them as parameters to the command. I prefer to keep attributes in the connector definition where possible as it is more “out of the box” and supportable. For instance, are you setting mail as an attribute rather than in the poweshell?
I might be able to help you @baoussounda , as I am currently working on mailbox provisioning and license assignment throughout JML process. Would you like to connect over privately? As I might have to type a lot of things out here during our conversation here.
You can actually set all the attributes required and not need powershell at all (which is what I do), but you have to have knowledge of another 3 AD attributes (fixed values) and that could be deemed less supportable.
As for your diagram above, you don’t need to wait for AAD Connect for the Sync to AAD before enable-remotemailbox, ie step 2 is redundant, but I wouldnt want to get too involved if that is what you have received from the Exchange guys.