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.
Best Answer
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
I was able to modify the license without issues.