I’m continuing my efforts to update MOC 20697-2 this
morning. I’ve decided to add additional information
on Office365. Microsoft removed over
2000 SaaS products from Azure in October of 2016. This resulted in 2 lessons of this class now
being void. While adding in content for
Exchange Online, I discovered an error.
Set-MsolUserLicense : You
must provide a required property: Parameter name: UsageLocation
At line:1 char:1
+ Set-MsolUserLicense
-UserPrincipalName "KFrog@Adatum2008JY.onmicrosof ...
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (:)
[Set-MsolUserLicense], MicrosoftOnlineException
+ FullyQualifiedErrorId :
Microsoft.Online.Administration.Automation.RequiredPropertyNotSetException,Microsoft.Online.Administration.Automation.SetUserLicense
This error played with me for a while. It is telling me that I am missing a property
and its’ parameter name is UsageLocation.
I went to the help file for Set-MsolUserLocation,
but that parameter is not part of the cmdlet.
What I discovered is that the user’s Azure AD object has a property
called UsageLocation and that it was
NULL. I utilized the Set-MsolUser cmdlet with its –UsageLocation parameter and set the
value to “US”.
Now this works:
$License = (Get-MsolAccountSku
| Where AccountSkuId
-like "*ENTERPR*").AccountSkuId
Set-MsolUserLicense -UserPrincipalName "KFrog@Adatum2008JY.onmicrosoft.com"
-AddLicenses $License
Comments