0 votes

Hi Team!

I'm currently looking for a solution to create an exchange mailbox on-premise, sync it to Office 365 and assign the license in one business rule.

I didn't find any powershell script that is working for me.

The Azure AD Sync, creating a mailbox on premise and assigning the license is already working fine. I'm stuck at the point where I need to migrate the mailbox to Exchange Online. I configured a business rule running all the custom commands(ps scripts).

Is there any solution from our side? Please let me know how to configure this.

Best Regards Marco Jandl

by (60 points)

1 Answer

0 votes
by (227k points)

Hello Marco,

Do we understand correctly that you need to have remote mailboxes for users? If that is correct, you do not need to follow the migration procedure. It is already outdated and is no longer recommended by Microsoft. To achieve the desired in Adaxes you only need to assign a Microsoft 365 license with access to Exchange Online to a user. Out of the box, Adaxes always enables remote mailboxes in such cases. For more details about configuring the feature, have a look at the following help article: https://www.adaxes.com/help/EnablingDisablingRemoteMailboxes.

If you still need to move mailboxes, have a look at the following script from our repository: https://www.adaxes.com/script-repository/move-mailbox-tofrom-microsoft-365-s579.htm.



Thanks for the quick answer.

Creating a remote mailbox is not possible since the users are created in Active Directory, not in EAC.

Moving mailboxes as described here does not work for me either. What rights/ run as user should be used for that custom command? Error is attached.

Maybe you know something else to migrate the mailboxes.

We are working in a hybrid environment with the users on-premise. (synced to the cloud) So the default process would be:

  • Create User with Adaxes Business Rule
  • Create Mailbox with Adaxes Business Rule
    • run AzureAD Sync Delta
    • move mailbox to Office 365 Cloud Services
    • Assign Office 365 License to user

2022_04_06_15_29_36_Run_Script_Test3_Marco.png 2022_04_06_15_38_30_WuP_Create_Exchange_Mailbox_and_Sync_User_to_Cloud_Adaxes_Administration_Con.png


Hello Marco,

You do not need to create a user in EAC to achieve the desired. The process we mentioned in the previous post will work just fine. No scripts or mailbox migrations are required. Please, give it a try. For information on how to automate assignment of Microsoft 365 licenses, have a look at the following tutorial: https://www.adaxes.com/tutorials_AutomatingDailyTasks_AutomaticallyAssignOffice365Licenses.htm.


So creating the mailbox and assigning the Office 365 license is all I have to do?

Can I check the status or is there a logging file where I can check if the mailbox is migrating to Cloud?

I will try it and let you know if it worked.

regards Marco


Hello Marco,

There will be no migration at all as it is not required. What you can check is the Recipient Type Details property. It should be displayed as Remote User Mailbox in Adaxes.

Assigning a Microsoft 365 license with access to Exchange Online will create a mailbox accordingly. At the same time Adaxes will enable a remote mailbox in on-premises Exchange. Later on AAD Connect will just match the pieces together. That is exactly the approach Microsoft recommends for creating remote mailboxes in a hybrid Exchange environment.



so now I have created a mailbox and assigned the O365 license and the user in Adaxes looks like this:

2022-04-06 16_48_54-Office - Adaxes Administration Console 2021.1.png

In MS 365 Admin Center the following status is shown:

2022-04-06 16_49_38-Home - Microsoft 365 admin center and 1 more page - \[InPrivate\] - Microsoft​ Edg.png

I suppose I just have to wait now until everything is synced properly?

Best regards Marco


Hello Marco,

That is not correct. Enabling a remote mailbox should be performed instantly. You need to use the scripts from the following article: https://www.adaxes.com/help/EnablingDisablingRemoteMailboxes. Make sure that the feature is enabled and a remote routing address template is specified.

Also, what exactly do you mean by created a mailbox? Please, provide all the exact steps you took with screenshots. you can post them here or send at support@adaxes.com.



seems like a Remote Mailbox is NOT enabled instantly.. Every time I create a new user and mailbox with Adaxes Business Rules, the system is creating a "UserMailbox".

Here are the settings:

Global Settings: 2022-04-07 11_18_39-khq-adm1 - Remote Desktop Connection.png

Creation Steps: 2022-04-07 12_13_11-WuP - Create Exchange Mailbox and Sync User to Cloud - Adaxes Administration Con.png

Business Rule Settings: 2022-04-07 11_18_03-Add Action.png

For now I'm just creating a mailbox (with the default business rule), run a dirsync with CloudAD and after that I activate the MS 365 account and assign location and license. Unfortunately the website is half-german however. Running the business rule, following error is showing up: 2022-04-07 12_24_49-Human Resources - Austria — Mozilla Firefox.png

There must be something wrong on my side, otherwise I can't explain why it is not working like you told me.

Best Regards Marco


Hello Marco,

The step for mailbox creation is exactly the reason why the desired behaviour fails. The action creates a mailbox in on-premises Exchange. It is not possible to create a remote mailbox in this case. All you need to do is remove the action from the workflow. There should be nothing in the entire workflow related to Exchange (both on-premises and online) except for Microsoft 365 license assignment.


It just worked. Thanks for helping me out!

Have a nice day!

BR Marco

Related questions

0 votes
1 answer

I'm testing making changes to a mailbox that is synced between AD and Office365. During changes updates are not reflected back. I'm prompted that the replication with AD Connect has ... in the web interface. If I go to the console I can see the change.

asked Aug 6, 2020 by ComputerHabit (790 points)
0 votes
1 answer

When creating a hybrid user mailbox with a Business Rule, after user creation, the remote routing address of the mailbox is set to the users email alias. How do I set it to the 365 address username@ourdomain.mail.onmicrosoft.com

asked Apr 13 by john.harding (70 points)
0 votes
0 answers

Hi Adaxes team, Not an issue but i'd like to have your feedback on Powershell scripts (in BR or Custom commands). Powershell remoting (i mean invoking Exchange ... to invoke Exchange cmdlet in Adaxes scripts or do you have any recommendation ? Thanks Stephen

asked Oct 2, 2012 by sroux (800 points)
0 votes
1 answer

Specifically I am looking to set Auto-Decline Invitations to Yes, and cancel all meetings (and use Inside My Organization reply). These appear to be new(ish) ... not able to find examples in the SDK documentation for setting these options via Powershell.

asked May 18 by Brian F (20 points)
0 votes
1 answer

Receive "Index operation failed; the array index evaluated to null. Stack trace: at <ScriptBlock>, <No file>: line 104>" and "Index operation failed; the ... $GroupName, $GroupDN." } } #foreach write-output "" Write-Output "" Stop-Transcript

asked Apr 14 by jbahou (20 points)
2,797 questions
2,530 answers
57,119 users