Skip to content

How to assign selective Office 365 license options

March 14, 2013

You may have users that only require Exchange Online or SharePoint Online or Lync Online. It’s a bit of a chew, but you can assign specific license options from a plan using PowerShell. I’ve already covered bulk licensing to all users and from CSV file in previous posts. Assigning individual services to an MSOL user follows similar steps but is slightly more involved:

1. Log on to a machine that has ‘Microsoft Online Services Module for Windows PowerShell’ installed. You can install this on your own workstation but it should also be installed on your ADFS Servers.

2. Enter the following command and specify credentials for an account that has administrator permissions to your MSOL subscription (such as admin@{tenant_id}.onmicrosoft.com):

$cred = Get-Credential

3. Enter the following command to connect to Microsoft Online Services:

Connect-MsolService -Credential $cred

4. Enter the following command to retrieve your organization’s license details:

Get-MsolAccountSku |ft AccountSkuId,SkuPartNumber

5. Note the AccountSkuId and SkuPartNumber values returned and use in the following steps

2013-03-14selective1

6. Note the SkuPartNumber value returned by the previous step and use it in the following command:

$ServicePlans = Get-MsolAccountSku | Where {$_.SkuPartNumber -eq "{SkuPartNumber}"}

For example:

$ServicePlans = Get-MsolAccountSku | Where {$_.SkuPartNumber -eq "ENTERPRISEPACK"}

2013-03-14selective2

7. Run the following command:

$ServicePlans.ServiceStatus

2013-03-14selective3

All service plans are returned. In the example above, we have the following:

  • RMS_S_ENTERPRISE
  • OFFICESUBSCRIPTION
  • MCOSTANDARD
  • SHAREPOINTWAC
  • SHAREPOINTENTERPRISE
  • EXCHANGE_S_ENTERPRISE

8. We must now create a new license SKU definition that applies only the desired service plans. This is done by disabling the plans we don’t want to apply. Refer back to Step 5 for the required AccountSkuId value and then run the following command:

${NewSkuDefinitionName} = New-MsolLicenseOptions -AccountSkuId {AccountSkuId} -DisabledPlans {Comma_Seperated_List_From_ServicePlans.ServiceStatus_Output}

For example, to create a license SKU definition that only assigns an Exchange Online license I would run the following command to exclude all plans except EXCHANGE_S_ENTERPRISE:

$ExchangeOnlineSku = New-MsolLicenseOptions -AccountSkuId ExitCodeZero:ENTERPRISEPACK -DisabledPlans RMS_S_ENTERPRISE,OFFICESUBSCRIPTION,MCOSTANDARD,SHAREPOINTWAC,SHAREPOINTENTERPRISE

2013-03-14selective4

9. Now you can assign the new license SKU definition to users:

a). Assign to individual users:

Set-MsolUser -UserPrincipalName {UserPrincipalName} -UsageLocation {UsageLocation}
Set-MsolUserLicense -UserPrincipalName {UserPrincipalName} -AddLicenses {AccountSkuId} -LicenseOptions ${NewSkuDefinitionName}

For example:

Set-MsolUser -UserPrincipalName 365Test1@fqdn.com -UsageLocation GB
Set-MsolUserLicense -UserPrincipalName 365Test1@fqdn.com -AddLicenses ExitCodeZero:ENTERPRISEPACK -LicenseOptions $ExchangeOnlineSku

b). Bulk assign using CSV import file:

$AccountSkuId = "{AccountSkuId}"
$UsageLocation = "{UsageLocation}"
$Users = Import-Csv {CSV_filename}
$Users | ForEach-Object {
Set-MsolUser -UserPrincipalName $_.UserPrincipalName -UsageLocation $UsageLocation
Set-MsolUserLicense -UserPrincipalName $_.UserPrincipalName -AddLicenses $AccountSkuId -LicenseOptions ${NewSkuDefinitionName}
}

For example:

$AccountSkuId = "ExitCodeZero:ENTERPRISEPACK"
$UsageLocation = "GB"
$Users = Import-Csv c:\temp\userlist.csv
$Users | ForEach-Object {
Set-MsolUser -UserPrincipalName $_.UserPrincipalName -UsageLocation $UsageLocation
Set-MsolUserLicense -UserPrincipalName $_.UserPrincipalName -AddLicenses $AccountSkuId -LicenseOptions $ExchangeOnlineSku
}

c). Bulk assign to all MSOL users (please proceed with caution):

$AccountSkuId = "{AccountSkuId}"
$UsageLocation = "{UsageLocation}"
$Users | Get-MsolUser -resultsize unlimited
$Users | ForEach-Object {
Set-MsolUser -UserPrincipalName $_.UserPrincipalName -UsageLocation $UsageLocation
Set-MsolUserLicense -UserPrincipalName $_.UserPrincipalName -AddLicenses $AccountSkuId -LicenseOptions ${NewSkuDefinitionName}
}

For example:

$AccountSkuId = "ExitCodeZero:ENTERPRISEPACK"
$UsageLocation = "GB"
$Users | Get-MsolUser -resultsize unlimited
$Users | ForEach-Object {
Set-MsolUser -UserPrincipalName $_.UserPrincipalName -UsageLocation $UsageLocation
Set-MsolUserLicense -UserPrincipalName $_.UserPrincipalName -AddLicenses $AccountSkuId -LicenseOptions $ExchangeOnlineSku
}

Advertisements
3 Comments
  1. Mohammed Sohail permalink

    Nice Job. Thank you 🙂

  2. Jim Basa permalink

    Perfect! This really helped me. Just a note, for newbies, don’t type ‘ExitCodeZero’ as part of the SkuID. I did that twice before realizing what I did wrong.

Trackbacks & Pingbacks

  1. Office 365 - Creating Custom SKUs - The Blog of Todd

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: