4

For the roll out of Office 365, we did not want to give all our users access to all the available applications/plans. So we only enabled Exchange, and Skype.

Now we're at the point where we want to enabled Yammer, and Office online, and we're running into issues.

$LicSKU = "<Hidden>:STANDARDPACK"
$ServicePlans = ((Get-MsolAccountSku | Where-Object {$_.AccountSkuId -eq $LicSKU}).ServiceStatus | Select-Object ServicePlan -ExpandProperty ServicePlan).ServiceName
$EnabledPlans = 'EXCHANGE_S_STANDARD','YAMMER_ENTERPRISE', 'SHAREPOINTWAC', 'MCOSTANDARD'
$DisabledPlans = @()
foreach($Plan in $ServicePlans) {
    if($EnabledPlans -notcontains $Plan) {
        $DisabledPlans += $Plan
    }
}
$LicOption = New-MsolLicenseOptions -AccountSkuId $LicSKU -DisabledPlans $DisabledPlans
try {
    $UserLicense = @{
        UserPrincipalName = $UserPrincipalName
        AddLicenses = $LicSKU
        LicenseOptions = $LicOption
    }
    Set-MsolUserLicense @UserLicense -ErrorAction Stop
}
catch [Microsoft.Online.Administration.Automation.MicrosoftOnlineException] {
    $UserLicense.Remove('AddLicenses')
    Set-MsolUserLicense @UserLicense -ErrorAction Stop
}

The error I get when I run this is the following :

Set-MsolUserLicense : Unable to assign this license.
+         Set-MsolUserLicense @UserLicense -ErrorAction Stop
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (:) [Set-MsolUserLicense], MicrosoftOnlineException
    + FullyQualifiedErrorId : Microsoft.Online.Administration.Automation.InvalidLicenseConfigurationException,Microsof
   t.Online.Administration.Automation.SetUserLicense

If I set the $DisablePlans = $null, then the same command runs fine without issues.

My current work around is to remove the license from the user, then add it back on with the updated plans enabled.

I'm hoping somebody has run into this problem before and found a proper solution for this.

7

Well, I'm an idiot. I went through the GUI and tried to add Office Online and it complained that it requires Sharepoint as well.

So when I updated the code to

$ServicePlans = ((Get-MsolAccountSku | Where-Object {$_.AccountSkuId -eq $LicSKU}).ServiceStatus | Select-Object ServicePlan -ExpandProperty ServicePlan).ServiceName
$EnabledPlans = 'EXCHANGE_S_STANDARD','YAMMER_ENTERPRISE', 'MCOSTANDARD', 'SHAREPOINTSTANDARD', 'SHAREPOINTWAC'
$DisabledPlans = @()
foreach($Plan in $ServicePlans) {
    if($EnabledPlans -notcontains $Plan) {
        $DisabledPlans += $Plan
    }
}

I was able to modify the license without issues.

| improve this answer | |
3

You could also try using Azure Portal for license management (Azure Active Directory - Licenses). It supports assigning licenses to user groups. So you would only need to do assignment once for some group which includes all users. And you would never need to do any assignment when new users are included.

| improve this answer | |
  • Thanks you for mentioning this option, I was looking into this recently and you need paid Azure AD to use this option, while the assign to user is free. – shinjijai May 30 '18 at 14:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.