Linked mailboxes in Microsoft 365 Exchange Online are used in hybrid environments where both Active Directory and Exchange Online are used. They allow you to keep a user's mailbox on-premises while still being able to access it in the cloud. In this article, we will provide a step-by-step guide on how to create and configure linked mailboxes in Microsoft 365 Exchange Online using PowerShell.
Here's a step-by-step process on how to create a linked mailbox in Exchange Online:
To create and configure linked mailboxes, you must first connect to Exchange Online PowerShell. To do this, open PowerShell as an administrator, and run the following commands:
$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session
You will be prompted to enter your Microsoft 365 credentials. Once you are connected, you can start creating and configuring linked mailboxes.
New-RemoteMailbox -Name <MailboxName> -OnPremisesOrganizationalUnit <OUPath> -Password (ConvertTo-SecureString <Password> -AsPlainText -Force) -LinkedDomainController <DCName> -LinkedMasterAccount <OnPremiseUserName>
Replace <MailboxName> with the name of the new mailbox, <OUPath> with the path to the organizational unit that the new mailbox will be created in, <Password> with a password for the new mailbox, <DCName> with the name of the domain controller for the on-premises environment, and <OnPremiseUserName> with the username of the mailbox in the on-premises environment that will be linked.
Get-RemoteMailbox <MailboxName>
To link the remote mailbox to an on-premises user account, you must create a mail-enabled user in Active Directory. A mail-enabled user is a user account in Active Directory that has an email address associated with it.
To create a mail-enabled user, run the following command:
Enable-MailUser -Identityuser@zylker.com -ExternalEmailAddress user@zylker.mail.onmicrosoft.com -Alias user-LinkedCredential $UserCredential -LinkedDomainController "DC1.zylker.com"
Replace the values in the command with your own values. The -Identity parameter specifies the email address of the user account in Active Directory. The -ExternalEmailAddress parameter specifies the email address of the remote mailbox. The -Alias parameter specifies the alias for the user account. The -LinkedCredential parameter specifies the credentials for the on-premises user account. The -LinkedDomainController parameter specifies the domain controller to use for linking the mailbox.
Enable-RemoteMailbox <OnPremiseUserName> -RemoteRoutingAddress <MailboxSMTPAddress>
Replace <OnPremiseUserName> with the username of the mailbox in the on-premises environment that will be linked, and <MailboxSMTPAddress> with the SMTP address of the mailbox in Exchange Online that will be linked to the on-premises mailbox.
Once the linked mailbox is created, you can manage it just like any other mailbox in Exchange Online. This includes setting permissions, creating rules, and setting up retention policies. By using linked mailboxes, organizations can easily move mailboxes between on-premises and online environments while maintaining the user's email history and other mailbox settings.
Assign Permissions: Assign the necessary permissions to manage linked mailboxes by running the following command:
Add-ADPermission -Identity<Linked Mailbox>-User<Admin Account>-AccessRights FullAccess -InheritanceType All
Replace the values in the command with the appropriate ones for your environment. This command will give full access rights to the admin account for the linked mailbox.
Check Permissions: Verify that the permissions have been added by running the following command:
Get-MailboxPermission <Linked Mailbox>|where {$_.user.tostring() -like'<Admin Account>'}
This command will display the permissions assigned to the admin account for the linked mailbox.
Remove Permissions: If necessary, you can remove the permissions by running the following command:
Remove-MailboxPermission-Identity<LinkedMailbox>-User<AdminAccount>-AccessRightsFullAccess-InheritanceTypeAll
Replace the values in the command with the appropriate ones for your environment. This command will remove full access rights from the admin account for the linked mailbox.
Disable a Linked Mailbox: If you need to disable a linked mailbox, you can run the following command:
Disable-RemoteMailbox -Identity <Linked Mailbox>
Replace the value in the command with the appropriate one for your environment. This command will disable the linked mailbox.
Enable a Linked Mailbox: To re-enable a linked mailbox, you can run the following command:
Enable-RemoteMailbox -Identity <UserAccount> -RemoteRoutingAddress <LinkedMailboxEmailAddress>
Replace the values in the command with the appropriate ones for your environment. This command will enable the linked mailbox.
Remove a Linked Mailbox: To remove a linked mailbox, you can run the following command:
Remove-RemoteMailbox-Identity<LinkedMailbox>
Replace the value in the command with the appropriate one for your environment. This command will remove the linked mailbox.
Linked mailboxes in Exchange Online allow you to link on-premises mailboxes with cloud-based mailboxes, providing a hybrid email solution for organizations. By following the steps outlined above, you can easily create, manage, and remove linked mailboxes, giving your users seamless access to their email regardless of their location.