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,,GB,Office365LabA:ENTERPRISEPREMIUM
Michael Freeman,Michael,Freeman,,GB,Office365LabA:ENTERPRISEPREMIUM
Andy Waters,Andy,Waters,,GB,Office365LabA:ENTERPRISEPREMIUM
Nic Horrocks,Nic,Horrocks,,GB,Office365LabA:ENTERPRISEPACK
Tom Owers,Tom,Owers,,GB,Office365LabA:ENTERPRISEPACK
Fay Williams,Fay,Williams,,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.

Get this blog post sent to you as a PDF file to read later

Enter your email address and press Send Now

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

Submit a Comment

Your email address will not be published. Required fields are marked *