Assign Subscription Licenses and License Options to Office 365 Users

In this previous article, we made basic license assignments to users in Office 365 using PowerShell.  When I say basic, the method is the simplest way to create an AD user, mailbox in Office 365, and enable all of the license options (Exchange Online, Office 365 ProPlus, Office Online, etc.) within a specific subscription license (Office 365 Enterprise E3, Enterprise Mobility Suite, etc.).

O365 Licensing 2


The following instructions will provide the ability to granularly enable license options by disabling the products within a specific subscription we do not want to use. What is odd to me is that to enable a license option in Office 365 we must disable the options we do not want enabled. It seems backwards, but it is what it is.

NOTE: This article makes an assumption that user accounts are present in Office 365 through manual addition or syncing from on premises.



First, Connect to Office 365 with PowerShell.



Before a subscription license and license options can be applied, a usage location is required to be assigned for each user that will be using Office 365 resources. This next command will assign the usage location of “US” (United States of America) for every unlicensed user in an Office 365 tenant.

NOTE: Other two letter country codes used by Microsoft can be found here.

Get-MsolUser -UnlicensedUsersOnly -All | Set-MsolUser -UsageLocation “US”

…or we can assign a usage location for an individual user using this command.

Set-MsolUser -UserPrincipalName -UsageLocation "US"

…or we can assign a usage location for list of O365 users using a CSV file and subsequent command.

This is an example of the CSV file used…

O365 Licensing 2

Import-Csv "C:\Scripts\MyO365Users.csv" | ForEach-Object { Set-MsolUser -UserPrincipalName $_.MyUPN -UsageLocation $_.MyUsageLocation }



From the PowerShell console, run the following command to get the subscription license SKU ID(s), license options and number of remaining licenses for each subscription in the Office 365 tenant.

Get-MsolAccountSku | %{$_.accountskuID;Write "Remaining Licenses:";($x =$_.ActiveUnits - $_.ConsumedUnits);$_.ServiceStatus | ft -hide}

The following are some subscriptions that may exist for an Office 365 tenant.

NOTE: Document the “tenantname” after running this command as it will be used in later.

tenantname:AAD_BASIC  (Azure Active Directory Basic)

tenantname:ENTERPRISEPACK  (Office 365 Enterprise E3)

tenantname:INTUNE_A  (Intune A Direct)

tenantname:EMS  (Enterprise Mobility Suite)


These are some of the license options within the Office 365 Enterprise E3 subscription. Take note of the license options available  in the tenant (after running the prior command) as they may and will vary for each O365 customer and as new features are added.


SWAY  (Sway)

INTUNE_O365  (Mobile Device Management for Office 365)

YAMMER_ENTERPRISE  (Yammer Enterprise)

RMS_S_ENTERPRISE  (Azure Rights Management)


MCOSTANDARD  (Skype for Business Online)

SHAREPOINTWAC  (Office Online)




These are some of the license options within the Enterprise Mobility Suite subscription…

RMS_S_PREMIUM  (Azure Rights Management Premium)
INTUNE_A  (Intune A Direct)
RMS_S_ENTERPRISE  (Azure Rights Management)
AAD_PREMIUM  (Azure Active Directory Premium)
MFA_PREMIUM  (Azure Multi-Factor Authentication)




Now that we’ve assigned a usage location for users and know what license subscriptions and options we have in the tenant, this next set of commands will assign a subscription license and license options for an individual user.  In this case, only Exchange Online will be enabled for the user—all other options are disabled.

NOTE: “Exchange Online” is not listed in the parameter for DisabledPlans because we are enabling the option for use.


Set-MsolUserLicense -UserPrincipalName "" -AddLicenses "tenantname:ENTERPRISEPACK" -LicenseOptions $MyLicenseOptions


O365 Licensing 3


If we want to assign subscription licenses and options in bulk (the same CSV file used to assign usage location can be utilized) we will use these set of commands.


Import-Csv "C:\Scripts\MyO365Users.csv" | ForEach-Object { Set-MsolUserLicense -UserPrincipalName $_.MyUPN -AddLicenses "tenantname:ENTERPRISEPACK" -LicenseOptions $MyLicenseOptions }

REMEMBER: If we use the same variable name (such as $MyLicenseOptions) in subsequent commands without either closing PowerShell or clearing the value of the variable (i.e. $MyLicenseOptions = $null), there is a high probability we will receive errors when making our additional license assignments.



If we wish to modify the existing assigned license options on a user that has already been assigned a license we use these two commands. Remember, we already have Exchange Online assigned to my user. If we want to enable Office 365 ProPlus (OFFICESUBSCRIPTION) and Skype for Business Online (MCOSTANDARD) for that user we need to remove the license options from the “DisabledPlans” parameter to enable them.  In this example, accessibility to use Skype for Business Online and download Office 365 ProPlus is made available.

NOTE: The Set-MsolUserLicense in this set of commands is slightly different from the previous set of commands in that we are not using the AddLicenses parameter.

Set-MsolUserLicense -UserPrincipalName "" -LicenseOptions $MyLicenseOptions


O365 Licensing 5


IMPORTANT: If we want to assign Office Online as a license option for any user, SharePoint Online (Plan 2) must be enabled either before or in tandem. If we attempt to assign Office Online without assigning SharePoint Online (Plan 2), we will receive one of the following error depending on where we attempt to make the product assignment. As of today, there aren’t any other product dependencies that I have come across.


O365 Licensing 6


O365 Licensing 7


And, if we want to modify license options in bulk (the same CSV file used to assign usage location can be utilized) we will use these set of commands.


Import-Csv "C:\Scripts\MyO365Users.csv" | ForEach-Object { Set-MsolUserLicense -UserPrincipalName $_.MyUPN -LicenseOptions $MyLicenseOptions }


Finally, if we choose to enable all of the products available in out Office 365 Enterprise E3 subscription, we will set the value for the DisabledPlans parameter to $null and the run the command to make the assignments for individual users or in bulk.



In this article, we connect to our Office 365 tenant through PowerShell, set usage locations for users, set a subscription license, and assign granular license options for users to access resources in O365.


Good luck and have fun!


My Related Articles:




2 thoughts on “Assign Subscription Licenses and License Options to Office 365 Users

  1. Do you know where I can find other license options within the Office 365 Enterprise E3 subscription for the new features ‘Flow for Office 365’ and ‘PowerApps for Office 365’ and ‘Microsoft Teams’? Thank you.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s