Support
 
Phone Live Chat
 
Support
 
US: +1 888 720 9500
 
Intl: +1 925 924 9500
Aus: +1 800 631 268
UK: 0800 028 6590
CN: +86 400 660 8680

Direct Inward Dialing: +1 408 916 9393

 
 
 
 
 

How to create an Exchange Online mailbox using PowerShell

Exchange Online mailboxes give employees and teams access to email, calendars, and contacts in Microsoft 365. This guide explains how to create user and shared mailboxes using PowerShell, the Microsoft 365 admin center, and ManageEngine ADManager Plus.

 
  • PowerShell
  • Microsoft 365 admin center
  • ADManager Plus
  • Troubleshooting
  • Post-creation steps
  • Why ADManager Plus
  • Real-world use cases
  • FAQ
 

How Exchange Online mailboxes are provisioned

A regular user mailbox isn't created by a standalone command; it is created as a result of license assignment. When a Microsoft 365 user account is assigned a license that includes Exchange Online, the service provisions the mailbox automatically, usually within minutes. So the real task for a user mailbox is creating the account and assigning the right license, not running New-Mailbox.

A shared mailbox is different: it has no primary user and doesn't require a license if it remains within the applicable size limit, so you create it directly with the New-Mailbox -Shared cmdlet. The New-Mailbox cmdlet is therefore the right tool for shared, room, and equipment mailboxes, and the licensing route is the right one for user mailboxes.

How to create a mailbox using Exchange Online PowerShell

Prerequisites

  • Permissions: The Recipient Management or Organization Management role in Exchange Online, or the Exchange Administrator role in Microsoft 365.
  • Tools: Install the Exchange Online Management module from an elevated PowerShell window:
    Install-Module -Name ExchangeOnlineManagement
  • Connection: Import the module and connect with an administrator account:
    Import-Module ExchangeOnlineManagement
    Connect-ExchangeOnline -UserPrincipalName admin@zylker.onmicrosoft.com

Create a shared mailbox with New-Mailbox

A shared mailbox is a natural fit for PowerShell's New-Mailbox cmdlet. Use the -Shared switch with a name, display name, and alias:

New-Mailbox -Shared -Name "Sales Department" -DisplayName "Sales Department" -Alias sales

After creating a shared mailbox, grant the team access to it. Add-MailboxPermission gives Full Access, and Add-RecipientPermission grants Send As permission, so members can send emails from the shared address:

Add-MailboxPermission -Identity "Sales Department" -User "jbond@zylker.com" -AccessRights FullAccess
Add-RecipientPermission -Identity "Sales Department" -Trustee "jbond@zylker.com" -AccessRights SendAs

The same cmdlet creates room and equipment mailboxes with the -Room and -Equipment switches for resource scheduling.

Create a user mailbox and the licensing requirement

For a user mailbox, the supported approach is to create and license the user, which provisions the mailbox. You can do this in the admin center as shown below, or with the Microsoft Graph PowerShell Set-MgUserLicense cmdlet to assign a license to an existing user:

Set-MgUserLicense -UserId "jbond@zylker.com" `
    -AddLicenses @{SkuId = "<exchange-or-m365-sku-id>"} -RemoveLicenses @()

An alternative legacy method uses the New-Mailbox -MicrosoftOnlineServicesID cmdlet, which creates the user and mailbox together but leaves the account unlicensed:

New-Mailbox -Name "James Bond" -DisplayName "James Bond" `
    -MicrosoftOnlineServicesID jbond@zylker.com `
    -Password (Read-Host -AsSecureString "Enter password")

If you use this method, ensure you assign an Exchange Online license within 30 days or the account may be disabled. For new deployments, creating a licensed user is the cleaner path.

Creating a mailbox for an existing or hybrid user

For an existing cloud user with no mailbox, assigning an Exchange Online license automatically provisions a mailbox. The hybrid case is different; when the user account is mastered in on-premises Active Directory and synced to the cloud by Microsoft Entra Connect (formerly Azure AD Connect), you create the cloud mailbox from on-premises Exchange with Enable-RemoteMailbox, which is run in the on-premises Exchange Management Shell:

Enable-RemoteMailbox -Identity "James Bond" `
    -RemoteRoutingAddress "jbond@zylker.mail.onmicrosoft.com"

This stamps the on-premises account with the attributes that tell Exchange Online to create a mailbox for it. The change takes effect after the next Entra Connect synchronization and the required license assignment. Creating the mailbox directly in the cloud for a synced user isn't supported, because the on-premises directory is authoritative for those accounts.

Bulk mailbox creation from a CSV file

Shared mailboxes are the common bulk-creation case, since user mailboxes are usually provisioned by licensing. Prepare a CSV with Name, DisplayName, and Alias columns, and loop through its rows with New-Mailbox -Shared:

Import-Csv "C:\Imports\shared-mailboxes.csv" | ForEach-Object {
    New-Mailbox -Shared -Name $_.Name -DisplayName $_.DisplayName -Alias $_.Alias
}

For a batch of user mailboxes, the equivalent is to create and license the user accounts in bulk, from the admin center's bulk option, PowerShell license assignment, or ADManager Plus. The mailboxes are then provisioned automatically.

Supported parameters

The parameters and cmdlets below are used for creating Exchange Online mailboxes.

Parameter Description
-Shared Creates a shared mailbox, which requires no license if it remains within the applicable size limit
-Room Creates a room mailbox
-Equipment Creates an equipment mailbox
-Name Specifies the mailbox's name
-DisplayName Specifies the name displayed in address lists
-Alias Specifies the mailbox's email alias
-MicrosoftOnlineServicesID Specifies the user's sign-in name (UPN) in the legacy user-mailbox creation syntax

Limitations of using PowerShell

  • Complex scripting required: Bulk shared-mailbox creation requires a CSV loop, and provisioning user mailboxes at scale requires a separate licensing script.
  • Duplicates aren't handled automatically: A clashing name or sign-in name causes the command to fail with no built-in way to resolve it on the fly.
  • Permissions are coarse: Running the cmdlets needs an administrator role with no simple way to let a technician create mailboxes for one business unit only.

How to create a user mailbox using the Microsoft 365 admin center

To create a user mailbox in the Microsoft 365 admin center, add a user and assign a license that includes Exchange Online. The mailbox is then provisioned automatically.

Prerequisites

  • Permissions: The User Administrator or Global Administrator role in Microsoft 365, which allows you to create users and assign licenses.
  • An available license: A license that includes Exchange Online (such as a Microsoft 365 Business or Enterprise plan) must be available in the tenant to assign to the new user.

Steps to follow

  1. Sign in to the Microsoft 365 admin center and navigate to Users > Active users.
  2. Click Add a user and enter the display name, username, and domain.
  3. Set a password and choose whether the user must change it at their next sign-in.
  4. On the licenses step, assign a license that includes Exchange Online (for example, a Microsoft 365 Business or Enterprise plan).
  5. Review the settings and click Finish adding.
Creating a user mailbox in the Microsoft 365 admin center
Creating a user mailbox in the Microsoft 365 admin center

The same applies to an existing user who has no mailbox: Assign them an Exchange Online license and the mailbox is created.

Limitations of using the Microsoft 365 admin center

  • One mailbox at a time: The admin center creates users individually with no way to provision many mailboxes in a single action from the interface.
  • Creation and licensing are separate steps: You create the user on one screen and assign the license on another; missing the license step leaves the mailbox inactive and starts a 30-day window for assigning it.
  • No shared or resource mailbox bulk path: Creating shared, room, or equipment mailboxes is manual, one by one, with no built-in bulk option.

How to create Exchange Online mailboxes using ADManager Plus

ADManager Plus is a unified AD, Exchange, and Microsoft 365 management and reporting tool that can create a user and provision its Exchange Online mailbox as part of the same workflow, assigning the license at the same time, from a point-and-click console with no scripting.

Creating a shared mailbox

  1. Navigate to Management > Mailbox Management. Select the type of mailbox you want to create, such as shared, room, or equipment mailbox. For example, to create a shared mailbox, select Create Single Shared Mailbox (or Create Bulk Shared Mailbox to create many at once) under Shared Mailbox Management.
  2. Select the domain and enter the display name, alias, and other required properties.
  3. Select Create to create the mailbox in Exchange Online.
Creating a shared mailbox in Exchange Online using ADManager Plus
Creating a shared mailbox in Exchange Online using ADManager Plus

Creating a user and mailbox together

  1. Navigate to Management > User Management > User Creation > Create Single User (or Create Bulk Users to create many at once).
  2. Select a user creation template, then fill in the required attributes.
  3. In the Microsoft 365 tab, select the licenses to assign, including an Exchange Online or Microsoft 365 license, so the mailbox is provisioned and activated when the user is created.
  4. Click Create User.
Creating a mailbox during user creation in ADManager Plus
Creating a mailbox during user creation in ADManager Plus

Troubleshooting common mailbox creation errors

  • The cmdlet isn't recognized: New-Mailbox is only available after connecting to Exchange Online. Run Connect-ExchangeOnline first, and confirm the ExchangeOnlineManagement module is installed.
  • Mailbox not found right after creation: The mailbox is still provisioning. Wait a few minutes then retry; propagation delay is the usual cause.
  • The user mailbox never appears: The account has no Exchange Online license. Assign a license that includes Exchange Online, and the mailbox will be provisioned automatically.
  • The user already exists: An account with the same name or MicrosoftOnlineServicesID is already present. Use a unique sign-in name, or license the existing account rather than creating a new one.
  • Access is denied: The account lacks a role that can create recipients. Use one with Recipient Management (or Exchange/Global Administrator) permissions, then reconnect and retry.

Post-creation steps and considerations

  • Assign the license within 30 days: If a user mailbox's account was created unlicensed, apply an Exchange Online license within the 30-day window to keep it active.
  • Allow for propagation: A new mailbox is usually ready within minutes, but can take up to a few hours to fully provision and appear in all tools; a mailbox not found error shortly after creation often just means it hasn't finished propagating.
  • Set up multi-factor authentication: For a user mailbox, enforce MFA (through a Conditional Access policy or security defaults) so the new account is protected from the first sign-in.
  • Grant access for shared mailboxes: Add Full Access and Send As permissions the team needs, as shown above, since a shared mailbox has no one assigned by default.

How ADManager Plus helps you provision mailboxes and users

ADManager Plus replaces scripts and one-off portal work with a single console for AD, Microsoft 365, and Exchange management and reporting:

Real world use cases

Use case 1: Create a mailbox for an on-premises user in a hybrid environment

This is the most common hybrid pitfall: An admin creates the AD user on-premises and assigns a Microsoft 365 license, but the mailbox doesn't provision correctly because the account's Exchange attributes were never set. The fix is to create the user in on-premises AD without email attributes, then run Enable-RemoteMailbox on-premises so the attributes are stamped and Entra Connect provisions the cloud mailbox on the next sync.

PowerShell (run in the on-premises Exchange Management Shell):

Enable-RemoteMailbox -Identity "James Bond" `
    -RemoteRoutingAddress "jbond@zylker.mail.onmicrosoft.com"

Then force the directory sync from the Entra Connect server rather than waiting for the scheduled cycle, and assign the license:

Start-ADSyncSyncCycle -PolicyType Delta

With ADManager Plus

  1. Navigate to Management > User Management > User Creation > Create Single User.
  2. Select a user creation template, then fill in the required attributes.
  3. In the Microsoft 365 tab, select the licenses to assign, including an Exchange Online or Microsoft 365 license, so the mailbox is provisioned and activated when the user is created.
  4. Click Create User.
Creating a mailbox for an on-premises user in ADManager Plus
Creating a mailbox for an on-premises user in ADManager Plus

Use case 2: Create a mailbox directly in Exchange Online

For a user mailbox, license the user, and the mailbox is provisioned automatically. For a shared mailbox, create it directly by running this command:

New-Mailbox -Shared -Name "Support" -DisplayName "Support" -Alias support

With ADManager Plus

  1. Navigate to Management > User Management > User Creation > Create Single User.
  2. Select a user creation template, then fill in the required attributes.
  3. In the Microsoft 365 tab, select the licenses to assign, including an Exchange Online or Microsoft 365 license, so the mailbox is provisioned and activated when the user is created.
  4. Click Create User.
Creating a mailbox for an Exchange Online user in ADManager Plus
Creating a mailbox for an Exchange Online user in ADManager Plus

Use case 3: Create a room mailbox for a conference room

Resource mailboxes let people book meeting rooms through Outlook. In PowerShell, run:

New-Mailbox -Room -Name "Conference Room 1010" -Alias confroom1010

With ADManager Plus

  1. Navigate to Management > Mailbox Management > Room Mailbox Management > Create Single Room Mailbox.
  2. Select the domain and enter the display name, alias, and other required properties.
  3. Click Create.
Creating a room mailbox using ADManager Plus
Creating a room mailbox using ADManager Plus

FAQ

Create a shared mailbox by connecting to Exchange Online PowerShell and using the -Shared switch:

New-Mailbox -Shared -Name "Support" -DisplayName "Support" -Alias support

A shared mailbox needs no license if it remains within the applicable size limit. Grant team members access with Add-MailboxPermission (Full Access) and Add-RecipientPermission (Send As).

If the user exists in Microsoft 365 without a mailbox, assign them an Exchange Online license and the mailbox is created automatically. If the user is an on-premises account synced through Entra Connect in a hybrid setup, run Enable-RemoteMailbox on-premises to create their cloud mailbox, then let the directory sync and license assignment finish.

A user mailbox requires a license that includes Exchange Online, and the mailbox is provisioned when that license is assigned. A shared mailbox does not require a license as long as it stays under the 50GB limit, so you can create it directly with New-Mailbox -Shared without assigning a license.

ADManager Plus Trusted By

The one-stop solution to Active Directory Management and Reporting