Licensing new Office 365 users

This is a quick guide on using PowerShell to assign Office 365 licenses to existing users that you have previously created. I’ve used this in environments where I have created large numbers of users in Office 365 using PowerShell as described in this post and then needed to assign licenses to those users so they can use their Office 365 mailboxes etc.

Connecting to Office 365 using PowerShell

One of the first things you will need to do is connect to your Office 365 tenant using PowerShell, for this you will need to have installed the Microsoft Online Services Module for PowerShell.

Once you have this open up an Administrative PowerShell session and type the command:

This will prompt you for credentials and in the box you should enter the credentials of a Global Admin for your Office 365 tenant.

Next type the following command which will initiate the connection for you, if there is no error and it just goes to the next line you know your connected successfully.

Checking your licensing

You will need to know the name of your licensing in order to be able to use PowerShell to assign licenses, for this type the command:

This will return a list of your licenses and should look something like this:


Licensing a single Office 365 user

You will first need to assign a usage location for the user which for me is GB as I am in the United Kingdom, check which one is for you then enter the command:

Then next you can assign your chosen license to the user:

You can run this command multiple times if you wish to assign multiple licenses. Now that user has a license and will able to access Office 365.

Licensing multiple Office 365 users

If you have created a bunch of new users in Office 365 chances are you used PowerShell (hopefully) and you don’t want to have to manually go through and assign Office 365 licenses for those new users, well you don’t have to thanks again to PowerShell.

You should have a CSV file with the following columns as shown below:


Note that on the first user above we are assigning them multiple licenses separated with a ; you will see why this is useful shortly.

Firstly we import the contents of the CSV file into a variable

Then we need to assign each of the users a Usage Location

Then finally we assign the licenses for the users

Once we have done all this those users will have the correct licenses assigned and be able to use Office 365.

Comments are closed.