↑ Return to Top 


Overview

In this exercise, we will license Office 365 users for the various workloads: SharePoint Online, Lync Online, and Exchange Online using the MOP UI (Microsoft Online Portal) as well as using the Microsoft Online Services Module for Windows PowerShell. We will license users individually, license in bulk, and count and check licenses in use by workload.

 

↑ Return to Top 


MOP UI

License users individually

  1. Browse to MOP, http://portal.microsoftonline.com) and sign into your Office 365 tenant
  2. On the Admin tab of MOP, click Users under Management

     

  3.  Check the checkbox next to a user account in the Users list
  4.  Click Edit in the toolbar at the top

    Note: You can also simply click the individual user name to get to the licensing screen. The checkboxes are useful when assigning licenses for multiple users.

  5. Check the checkbox next to your plan (i.e. - Microsoft Office 365 Plan E3)
  6.  Check all of the checkboxes next to Office, Lync, Office Web Apps, SharePoint, and Exchange
  7. Click Save

 

↑ Return to Top 

License users in bulk

  1. Check the checkbox next to multiple user accounts in the Users list
  2. Click Edit in the toolbar at the top
  3. Click Next twice since we are not making any Details or Settings changes
  4. You should now be on the Licenses screen with 3 options:
    • Retain current license assignments
    • Replace existing license assignments
    • Add to existing license assignments
  5. Select Replace existing license assignments and check the checkboxes for all available workloads:

  6. Click Submit and click Finish

 

↑ Return to Top 


Microsoft Online Services Module for Windows PowerShell

License users individually  

Launch Microsoft Online Services Module for Windows PowerShell and enter the command:

Connect-MsolService

 

Type your tenant Global Administrator credentials in the pop-up.

Note: If there is a newer version of the PowerShell module, you will see yellow warning text explaining that a newer version is available. We should always be sure that we are running the latest version of the module.

We need to obtain the AccountSkuId values so that we are licensing within a licensing pack that the tenant is set up for. In our example here, we have an E3 trial tenant, which has an ENTERPRISEPACK AccountSkuId prefixed with our tenant name, which contains:

  1. OFFICESUBSCRIPTION (Office 2010)
  2. MCOSTANDARD (Lync Online)
  3. SHAREPOINTWAC (SharePoint Online)
  4. SHAREPOINTENTERPRISE (SharePoint Online)
  5. EXCHANGE_S_ENTERPRISE (Exchange Online)

 

Get-MsolAccountSku

You’ll see the AcountSkuId, ActiveUnits, WarningUnits, and ConsumedUnits. 

Get-MsolAccountSku | Format-Table AccountSkuId, SkuPartNumber

The second column in this list is referenced in the next command as SkuPartNumber. We only have ENTERPRISEPACK, but need to keep in mind that you may have multiple packs to choose from. Replace SkuPartNumber in the following command with ENTERPRISEPACK.

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

$ServicePlans.ServiceStatus

This returns all the service plans. We will choose to disable MCOSTANDARD (Lync Online). The cmdlet we use to set user licenses requires a LicenseOption object as input. 

The following command gets us a LicenseOption object

$myO365Sku = New-MsolLicenseOptions -AccountSkuId your-tenant-name:ENTERPRISEPACK -DisabledPlans MCOSTANDARD

$myO365Sku.GetType() 

Notice this is a LicenseOption object.

Next, we can assign licenses to a user object

Users must have a UsageLocation value set prior to accepting licensing. UsageLocation is a 2-letter value representing the country in which the user will utilize the account:

Set-MSOLUser –UserPrincipalName your-user-UPN –UsageLocation US 

Set the licensing. The following command will assign all licenses for the ENTERPRISEPACK:

Set-MsolUserLicense -UserPrincipalName your-user-UPN -AddLicenses your-tenant-name:ENTERPRISEPACK 

Note: Similar to the –AddLicenses parameter, Set-MsolUserLicense also has a –RemoveLicenses parameter which can be used to remove license packs from a user object. 

Finally, we need to disable Lync Online for this user:

Set-MsolUserLicense -UserPrincipalName your-user-UPN –LicenseOptions $myO365Sku 

 Let’s take a look at a user who has licensing added to get a feel for what the object should look like in PowerShell when the user object has been licensed for at least one workload. Your Global Administrator account is a good choice.

Get-MsolUser –UserPrincipalName “your-Global-Admin-UPN”

 

Notice that the default view shows us a column that shows isLicensed = True. This means that this object has been licensed for at least one workload.

Get-MsolUser –UserPrincipalName “your-Global-Admin-UPN” | Format-List

 

This shows us several of the object’s attributes and their values. Notice that the Licenses attribute shows us the value of the AccountSkuId. Let’s dig further into the Licenses property to see what else we can find out about how this user is licensed:

$existingLicense = (Get-MsolUser –UserPrincipalName “your-Global-Admin-UPN” ).Licenses

$existingLicense.GetType()

 

 

Notice that this is a List object. If you run $existingLicense.Count, you’ll see that it has just one item in the list.

Next, we’ll break apart the list item:

$existingLicenseDetail = $existingLicense[0]

 

You can now see all of the properties of our new variable by appending it with a “.” and tabbing through the property list:

$existingLicenseDetail. (use the Tab key to cycle through the property list)

 

We can see that $existingLicenseDetail is a UserLicense object by running:

$existingLicenseDetail.GetType()

 

We can see the AccountSkuId for this user’s licenses:

$existingLicenseDetail.AccountSkuId

 

We can see the licensed workloads and also the provisioning status for each workload:

$existingLicenseDetail.ServiceStatus

 

Our Global Administrator shows that he is licensed for all available workloads and the ProvisioningStatus shows a Success status for each workload:

 

Finally, here is a one-liner which will show you licensing for a specific user:

(Get-MSOLUser –UserPrincipalName your-user-UPN).Licenses[0].ServiceStatus

 

Try the one-liner command to verify that you successfully licensed your user for everything in ENTERPRISEPACK except Lync Online:

 

↑ Return to Top 

License users in bulk

myO365Sku

Set $myO365Sku so that there are no service plans disabled

$myO365Sku = New-MsolLicenseOptions –AccountSkuId your-tenant-name-ENTERPRISEPACK

 

Dump out $myO365Sku so you can see that DisabledServicePlans is $null

$myO365Sku

 

↑ Return to Top

UsageLocation

 Set UsageLocation for all of your users. 

You can pipe the output from Get-MsolUser as input to another cmdlet which normally requires you to specify a user object:/span>

Get-MsolUser -All | Set-MsolUser –UsageLocation US

 

↑ Return to Top 

License user for Enterprise Pack

License all of your users for everything in ENTERPRISEPACK

 

The following command will error for any user who has a license in the ENTERPRISEPACK already:/span>

Get-MsolUser -All | Set-MsolUserLicense -AddLicenses your-tenant-name:ENTERPRISEPACK

 

Set LicenseOptions to ensure that all users are licensed for all workloads in the ENTERPRISEPACK:

Get-MsolUser -All | Set-MsolUserLicense –LicenseOptions $myO365Sku

 

Note: Rather than set licensing for all users, PowerShell offers you the flexibility to filter user objects so that you are licensing only a subset of your user base. Filter example:

Get-MsolUser -All | where {$_.UserPrincipalName -match "contoso.com"} | Set-MsolUserLicense -LicenseOptions $myO365Sku

 

↑ Return to Top

Get licenses for an individual user

((Get-MsolUser -UserPrincipalName your-user-UPN).Licenses[0]).ServiceStatus

 

↑ Return to Top

Get a list of users who are licensed or not licensed per workload

If you look at the AccountSkuId for a P tenant, you’ll see your-tenant-name:LITEPACK

 

P Tenant Product ProvisioningStatus Index to Use

Lync Online

0

SharePoint Online

1

Exchange Online

2

 

Referring to an E3 tenant, if you look at the AccountSkuId, you’ll see your-tenant-name:ENTERPRISEPACK

 

E3 Tenant Product

ProvisioningStatus Index to Use

Office

0

Lync Online

1

SharePoint Online

3

Exchange Online

4

 

The ServiceStatus.ServicePlan is ordered consistently between objects, so we can do things like finding out who is licensed for each service individually, or who is missing a license for each service.

 

↑ Return to Top 


Examples

The following examples apply to any E3 SKU.

Note: We are making sure they are licensed for at least one service, and then working through array elements and checking to see if the value is “Disabled”.

 

↑ Return to Top 

Office Subscription

Users licensed

Get-MsolUser -All | where {$_.isLicensed -eq $true -and $_.Licenses[0].ServiceStatus[0].ProvisioningStatus -ne "Disabled"}

 

↑ Return to Top 

Users NOT licensed

Get-MsolUser -All | where {$_.isLicensed -eq $true -and $_.Licenses[0].ServiceStatus[0].ProvisioningStatus -eq "Disabled"}

 

↑ Return to Top 

Lync Online

Users licensed

Get-MsolUser -All | where {$_.isLicensed -eq $true -and $_.Licenses[0].ServiceStatus[1].ProvisioningStatus -ne "Disabled"}

 

Users NOT licensed

Get-MsolUser -All | where {$_.isLicensed -eq $true -and $_.Licenses[0].ServiceStatus[1].ProvisioningStatus -eq "Disabled"}

 

↑ Return to Top 

SharePoint Online

Users licensed

Get-MsolUser -All | where {$_.isLicensed -eq $true -and $_.Licenses[0].ServiceStatus[3].ProvisioningStatus -ne "Disabled"}

 

Users NOT licensed

Get-MsolUser -All | where {$_.isLicensed -eq $true -and $_.Licenses[0].ServiceStatus[3].ProvisioningStatus -eq "Disabled"}

 

↑ Return to Top 

Exchange Online

Users licensed

Get-MsolUser -All | where {$_.isLicensed -eq $true -and $_.Licenses[0].ServiceStatus[4].ProvisioningStatus -ne "Disabled"}

 

Users NOT licensed

Get-MsolUser -All | where {$_.isLicensed -eq $true -and $_.Licenses[0].ServiceStatus[4].ProvisioningStatus -eq "Disabled"}

 

↑ Return to Top 


Check provisioning status across the board or per workload

You can make a simple modification to see if we have any provisioning issues for any users.

 

↑ Return to Top 

ALL Products

Provisioning SUCCESS for ALL products

Get-MsolUser -All | where {$_.isLicensed -eq $true -and $_.Licenses[0].ServiceStatus[0].ProvisioningStatus -eq "Success" -and $_.Licenses[0].ServiceStatus[1].ProvisioningStatus -eq "Success" -and $_.Licenses[0].ServiceStatus[3].ProvisioningStatus -eq "Success" -and $_.Licenses[0].ServiceStatus[4].ProvisioningStatus -eq "Success"}

 

↑ Return to Top 

Provisioning NOT COMPLETE for ALL products

Get-MsolUser -All | where {$_.isLicensed -eq $true -and $_.Licenses[0].ServiceStatus[0].ProvisioningStatus -ne "Disabled"-and $_.Licenses[0].ServiceStatus[0].ProvisioningStatus -ne "Success” -and $_.Licenses[0].ServiceStatus[1].ProvisioningStatus -ne "Disabled"-and $_.Licenses[0].ServiceStatus[1].ProvisioningStatus -ne "Success” -and $_.Licenses[0].ServiceStatus[3].ProvisioningStatus -ne "Disabled"-and $_.Licenses[0].ServiceStatus[3].ProvisioningStatus -ne "Success” -and $_.Licenses[0].ServiceStatus[4].ProvisioningStatus -ne "Disabled"-and $_.Licenses[0].ServiceStatus[4].ProvisioningStatus -ne "Success”}

 

↑ Return to Top

Office subscription

Provisioning SUCCESS

Get-MsolUser -All | where {$_.isLicensed -eq $true -and $_.Licenses[0].ServiceStatus[0].ProvisioningStatus -eq "Success"}

 

Provisioning NOT COMPLETE

Get-MsolUser -All | where {$_.isLicensed -eq $true -and $_.Licenses[0].ServiceStatus[0].ProvisioningStatus -ne "Disabled"-and $_.Licenses[0].ServiceStatus[0].ProvisioningStatus -ne "Success” }

 

↑ Return to Top

Lync Online

Provisioning SUCCESS

Get-MsolUser -All | where {$_.isLicensed -eq $true -and $_.Licenses[0].ServiceStatus[1].ProvisioningStatus -eq "Success"}

 

Provisioning NOT COMPLETE

Get-MsolUser -All | where {$_.isLicensed -eq $true -and $_.Licenses[0].ServiceStatus[1].ProvisioningStatus -ne "Disabled"-and $_.Licenses[0].ServiceStatus[1].ProvisioningStatus -ne "Success” }

 

↑ Return to Top 

SharePoint Online

Provisioning SUCCESS for

Get-MsolUser -All | where {$_.isLicensed -eq $true -and $_.Licenses[0].ServiceStatus[3].ProvisioningStatus -eq "Success"}

 

Provisioning NOT COMPLETE

Get-MsolUser -All | where {$_.isLicensed -eq $true -and $_.Licenses[0].ServiceStatus[3].ProvisioningStatus -ne "Disabled"-and $_.Licenses[0].ServiceStatus[3].ProvisioningStatus -ne "Success” }

 

↑ Return to Top

Exchange Online

Provisioning SUCCESS

Get-MsolUser -All | where {$_.isLicensed -eq $true -and $_.Licenses[0].ServiceStatus[4].ProvisioningStatus -eq "Success"}

 

Provisioning NOT COMPLETE

Get-MsolUser -All | where {$_.isLicensed -eq $true -and $_.Licenses[0].ServiceStatus[4].ProvisioningStatus -ne "Disabled"-and $_.Licenses[0].ServiceStatus[4].ProvisioningStatus -ne "Success” }

 

↑ Return to Top 


Additional Samples

#get MSOL users who do not have a license assigned into a collection (array)

[Array]$AllUnlicensedUsers = Get-MsolUser -UnlicensedUsersOnly

 

#show a count of all unlicensed MSOL users

If ($AllUnlicensedUsers -ne $null)

{

 $AllUnlicensedUsers.Count

}

 

#get MSOL users who are in the default domain into a collection (array)

[Array]$DefaultDomUsers = Get-MsolUser -All | Where { $_.UserPrincipalName -match "onmicrosoft.com" }

 

#show a count of all MSOL users in the default domain

If ($DefaultDomUsers -ne $null)

{

 $DefaultDomUsers.Count

}

 

#get MSOL users who are in a specific vanity domain into a collection (array)

[Array]$VanityDomUsers = Get-MsolUser -All | Where { $_.UserPrincipalName -match "enter-vanity-domain-here" }

 

#show a count of all MSOL users in the vanity domain

If ($VanityDomUsers -ne $null)

{

 $VanityDomUsers.Count

}

 

#combine the logic into a single command: get MSOL users who are in a specific domain and are not licensed (array)

[Array]$VanityDomUnlicensedUsers = Get-MsolUser -UnlicensedUsersOnly | Where { $_.UserPrincipalName -match "enter-vanity-domain-here" }

 

#show a count of all MSOL users in the vanity domain who are not licensed

If ($VanityDomUnlicensedUsers -ne $null)

{

 $VanityDomUnlicensedUsers.Count

}

 

#whichever collection of users you select, you can use the pipe '|' character with a ForEach-Object statement to perform license assignment

If ($VanityDomUnlicensedUsers -ne $null)

{

 #a supported UsageLocation must be set for each user prior to assigning a license

 $VanityDomUnlicensedUsers | ForEach-Object

 {

 #set UsageLocation

 Set-MsolUser -UserPrincipalName $_.UserPrincipalName –UsageLocation "enter-usage-location-here"

 #assign license pack

 Set-MsolUserLicense -UserPrincipalName $_.UserPrincipalName -AddLicenses "enter-license-pack-name-here"

 }

}

 

#after licenses have been assigned, you'll want to check your work

#get all MSOL users who remain unlicensed

[Array]$AllUnlicensedUsers = Get-MsolUser -UnlicensedUsersOnly

 

#show a count of all unlicensed MSOL users

If ($AllUnlicensedUsers -ne $null)

{

 $AllUnlicensedUsers.Count

}

 

#get all MSOL users who have the expected license assignment

[Array]$AllSuccessfulLicensedUsers = Get-MsolUser -All | Where { $_.Licenses.AccountSkuId -match "enter-license-pack-name-here" }

 

#show a count of all unlicensed MSOL users

If ($AllSuccessfulLicensedUsers -ne $null)

{

 $AllSuccessfulLicensedUsers.Count

}

 

↑ Return to Top 


See Also

 

↑ Return to Top