Exchange Online Shared Mailbox Bulk Create

Dominik Dudczak 176 Reputation points

Hi Everyone,

I am currently trying to setup shared mailboxes for an organisation. As it is a Pain in the A** to create them inside the portal one by one (especially if we are talking about ~ 100 Mailboxes). I tried to realize that via Powershell and a CSV file. This is what i got so far:

Import-Csv "C:\Users\Example\Documents\Mailboxes.csv" | foreach-object {​​​​ New-Mailbox -Name $.MyName -DisplayName $.MyDisplay -Shared }

And this is the Format of the according csv File:




So far so good, it creates the Mailboxes out of the CSV file without any Issues. Now I need to assign mailbox permissions for those mailboxes. Sure I could do that with a new CSV File in the same way again:

Import-Csv "C:\Users\Example\Documents\Access" | foreach-object { Add-MailboxPermission $.Mailbox -User $.User -AccessRights $_.Access }

With the according CSV File again:


test,user@keyman ,FullAccess

test,user2@keyman ,FullAccess

test1,user2@keyman ,FullAccess

This way I can already save some time but I still have to created the two CSV files and depending on how many user have permissions to the same mailbox, the CSV file gets rather long and repetitive.

My Questions now are:

  1. Is there a way to create the mailboxes and assign the permissions in the same step using only one csv file?
  2. Am I taking the wrong approach and is there a better one than working with CSV files ?
  3. If yes please explain other possibilities I have to achieve my goal.
  4. Is there a way to pass an array to the powershell command (for the parameter -User for example) ?

Looking forward to your inputs and thoughts on this.

Thank you in advance :)


Microsoft Exchange Online Management
Microsoft Exchange Online Management
Microsoft Exchange Online: A Microsoft email and calendaring hosted service.Management: The act or process of organizing, handling, directing or controlling something.
3,860 questions
0 comments No comments
{count} votes

Accepted answer
  1. KyleXu-MSFT 26,171 Reputation points

    anonymous user

    The "-User" doesn't accept array, so you need to add permission one by one:

    If you want to use one CSV file as source file, you need to change it into this format:

    The you could use script below to create shared mailbox and add permission:

    $Datas  = import-csv d:/temp/shared.csv  
    foreach($Data in $Datas){  
        if((Get-Mailbox $ -erroraction 'silentlycontinue') -eq $null){  
            New-Mailbox -Name $data.Name -DisplayName $data.DisplayName -Shared  
        Add-MailboxPermission -Identity $data.Name -User $data.User -AccessRights $data.AccessRights  


    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful