How to Bulk Add Users into Office 365 using PowerShell

One of the easiest ways to import users in bulk when not using AD Connect to synchronize an on-premises Active Directory is to use a CSV file.

Create a new text file and copy in the following text and save the file as users.csv. Use these entries as an example and modify them to match your own requirements. One thing to note here is that the AccountSkuId value defines the license you want to assign to the user:

DisplayName,FirstName,Last Name,UserPrincipalName,UsageLocation,AccountSkuId
Ian Waters,Ian,Waters,ian.waters@office365lab.co.uk,GB,Office365LabA:ENTERPRISEPREMIUM
Michael Freeman,Michael,Freeman,michael.freeman@office365lab.co.uk,GB,Office365LabA:ENTERPRISEPREMIUM
Andy Waters,Andy,Waters,andy.waters@office365lab.co.uk,GB,Office365LabA:ENTERPRISEPREMIUM
Nic Horrocks,Nic,Horrocks,nic.horrocks@office365lab.co.uk,GB,Office365LabA:ENTERPRISEPACK
Tom Owers,Tom,Owers,tom.owers@office365lab.co.uk,GB,Office365LabA:ENTERPRISEPACK
Fay Williams,Fay,Williams,fay.williams@office365lab.co.uk,GB,Office365LabA:ENTERPRISEPACK

You can also use Excel to build your user list as shown below, just remember to save it as a Comma Separated Value (CSV) file.

Office 365 Bulk Import 1

In this example we save the file to the root of C as c:\results.csv, connect a PowerShell console to Office 365. If your not sure how to do that then quickly go read this blog post on how to do that here.

Import-Csv -Path “C:\Users.csv” | ForEach {New-MsolUser -DisplayName $_.DisplayName -FirstName $_.FirstName -LastName $_.LastName -UserPrincipalName $_.UserPrincipalName -UsageLocation $_.UsageLocation -LicenseAssignment $_.AccountSkuId} | Export-Csv -Path “C:\Results.csv”

Office 365 Bulk Import 2

After a few seconds the script will save the results in the CSV file which will include the password for each user.


Using PowerShell to import large numbers of users is super easy. If you are migrating from another system then pulling out the required information and modifying it to run this script shouldn’t cause you too many problems and will save you a lot of time. Give it a try in your test lab now.

[email-download download_id=”11011″ contact_form_id=”9351″]

If you want to get stuck in then you can buy my book from Amazon either the paper back or kindle version. My advice is to buy the paperback version so you can keep it on your desk for easy reference!

Office 365 PowerShell Book

For paperback version click here

For Kindle version click here

Author: Ian@SlashAdmin

Share This Post On
468 ad

1 Comment

  1. And How i put more than one license?

    Post a Reply

Submit a Comment

Your email address will not be published.