Assigning Office 365 License Options with PowerShell

As part of planning a rollout of Office 365 to your organization you should decide which Office 365 products you will be part of your service offering. When you sign up for Office 365 you will select a plan such as E1 or E3. If you assign one of these licenses to a user in your organization, by default they will receive all of the Office 365 products (called license options) associated with the product.

For example an E3 license will include Exchange, SharePoint, OneDrive, Yammer, Planner, Sway, Flow, PowerApps, StaffHub, etc. Your tenant administrator can view these options in the Office 365 admin center.

The license options available for my Office 365 developer tenant are shown below.

Even though you are licensed for all of those products, your organization will need to determine which products will be available to your users. If you make a product available you will need to provide training, support, administration, setup, security and so forth. If you want to turn off one or more products there is no global ‘off switch’. You will need to unassign the license option for each user.

If you have a large number of users this is very tedious to do this through the admin center screens. A better option would be to set the license options with a PowerShell script. This can sound intimidating, but it’s really not terribly difficult as far as PowerShell scripts go.

The example script below disables the Flow and PowerApps licenses for all users in a tenant. If you want to set different license options you can do so (disable Yammer, etc).

Import-Module MSOnline;
$UserCredential = Get-Credential;
Connect-MsolService -Credential $UserCredential;
$x = New-MsolLicenseOptions -AccountSkuId "yourdomain:DEVELOPERPACK" -DisabledPlans "FLOW_O365_P2", "POWERAPPS_O365_P2";

#single user
#Set-MsolUserLicense -UserPrincipalName user@yourdomain.com -LicenseOptions $x

#All Users
Get-MsolUser | Where-Object {$_.isLicensed -eq $True} | Set-MsolUserLicense -LicenseOptions $x;

This technet article provides a good walkthrough of the process of creating your own license assignment PowerShell script.
https://technet.microsoft.com/library/dn771770.aspx