How to manage mailboxes in Office 365 after migrating them within a hybrid environment

Problem:

After you have migrated mailboxes within your hybrid environment with CodeTwo migration tools, you are unable to change some of the user settings in Office 365 – both via Windows PowerShell or Exchange admin center in Exchange Online. You receive the following or similar message:

This user is synchronized with your local Active Directory. Some details can be edited only through your local Active Directory.

This problem may occur when you have deleted migrated mailboxes from your on-premises environment or decommissioned on-premises Exchange Server. 

Solution:

Assuming that you have followed the steps from this article, before attempting to migrate mailboxes you had to disable the synchronization of the msExchMailboxGuid attribute between on-premises Active Directory users and Office 365 users. However, even without this attribute, Office 365 users are still synced with the local Active Directory and, because of that, they need to be managed through the on-premises Exchange organization

If you have already deleted the mailboxes from your on-premises environment (or decommissioned the on-premises server), you need to disable directory synchronization to be able to manage migrated mailboxes through Office 365. Follow the steps below to learn how to do so:

  1. Connect to Azure AD by running the following commands in Windows PowerShell:
    Install-Module MSOnline
    Connect-MsolService
    
    When prompted, provide your Office 365 global admin credentials.
  2. Disable directory synchronization by using the following cmdlet:
    Set-MsolDirSyncEnabled –EnableDirSync $false
    

    Important

    The changes can propagate even up to 72 hours, depending on the number of objects being synced. You can view the directory synchronization status by running:

    (Get-MSOLCompanyInformation).DirectorySynchronizationEnabled
    

    If the cmdlet returns True, you need to wait longer. If you get False instead, it means that the directory synchronization has been deactivated.

    You can also log in to Microsoft 365 (Office 365) admin center and check the value in the Sync Type column for each user (Fig. 1.). If it shows In cloud, it means that this user is not synchronized with the local Active Directory anymore.

750-1
Fig. 1. Verifying the directory synchronization
status in Microsoft 365 admin center.

You should now be able to manage your mailboxes in Microsoft 365 admin center or via Windows PowerShell.

Warning

If you would like to re-activate directory synchronization, be aware that the synchronization settings might not be restored to their previous state. You may want to consult this Microsoft article before doing so.