When instructing an Office 365 class, I was asked a question about granular license assignment from PowerShell. The ask was with regards to the options we have in the UI for licensing users. For instance, from the Microsoft Online Portal we can assign an E3 class license, which we can then further filter to limit the services within the license. We can assign the E3 license but remove the Exchange Online option for the user. Alternatively, we can remove the Office subscription access for the user and so on.

Many customers like to script the licensing/provisioning of users so we were asked if there is a process for this same granular management in PowerShell.  The answer is below, there was a combination of people that found the correct cmdlets to accomplish this task.
First, enumerate the licence plans and create your own licence:

  1. Open Microsoft Online Services Module for Windows PowerShell and connect to the service
  • $cred = Get-Credential
  • Connect-MsolService -Credential $cred
  • Get-MsolAccountSku | Format-Table AccountSkuId, SkuPartNumber
  • The second column in this list is referenced in the next command as [SkuPartNumber]
  • $ServicePlans = Get-MsolAccountSku | Where {$_.SkuPartNumber -eq "[SkuPartNumber]"}
  • $ServicePlans.ServiceStatus
  • This returns all the service plans
  • $MyO365Sku = New-MsolLicenseOptions -AccountSkuId [tenantname:AccountSkuId] -DisabledPlans Comma_Seperated_List_From_ServicePlan_Output

Secondly you need to assign the licence to the user(s):

  1. Set-MsolUser -UserPrincipalName user@domain.com -UsageLocation GB
  2. Set-MsolUserLicense -UserPrincipalName user@domain.com -AddLicenses [tenantname:AccountSkuId] -LicenseOptions $MyO365Sku
  3. Repeat for any other licences you want to apply for other users or other licence options you want to apply to this user.

For reference, the SkuPartNumber's that we discovered are:
Inside ENTERPRISEPACK Sku:

  • OFFICESUBSCRIPTION (this is Office Professional Plus)
  • MCOSTANDARD (this is Lync)
  • SHAREPOINTWAC (this is Office Web Apps)
  • SHAREPOINTENTERPRISE
  • EXCHANGE_S_ENTERPRISE

Inside DESKLESSWOFFPACK Sku:

  • SHAREPOINTWAC
  • SHAREPOINTDESKLESS
  • EXCHANGE_S_DESKLESS

Inside EXCHANGEARCHIVE Sku

  • EXCHANGE_S_ARCHIVE

This content was created by Brian Reid (C7Solutions), Donte Henry (Avanade), and Timothy Heeney (Microsoft), during the MCM Office 365 training class