-
Notifications
You must be signed in to change notification settings - Fork 211
Description
Describe the bug
When removing a license assigned to a user, as per this example in the learn articles: https://learn.microsoft.com/en-us/powershell/module/microsoft.graph.users.actions/set-mguserlicense?view=graph-powershell-1.0#example-6-remove-a-license-assigned-to-a-user
It generates an error:
Set-MgUserLicense_AssignExpanded: One or more parameters of the operation 'assignLicense' are missing from the request payload. The missing parameters are: addLicenses.
Status: 400 (BadRequest)
ErrorCode: Request_BadRequest
Expected behavior
The license assignment should be removed from the user.
How to reproduce
set-mguserlicense -userid %objectidofuser% -AddLicenses @() -RemoveLicenses @($licenseSkuId)
where $licenseSkuID variable is the SkuId value of the applicable license as pulled from Get-MgSubscriptedSku
SDK Version
2.26.1
Latest version known to work for scenario above?
Yes - dont know which prior version
Known Workarounds
No response
Debug output
Body:
{
"error": {
"code": "Request_BadRequest",
"message": "One or more parameters of the operation 'assignLicense' are missing from the request payload. The missing parameters are: addLicenses.",
Configuration
Name Value
PSVersion 7.5.0
PSEdition Core
GitCommitId 7.5.0
OS Microsoft Windows 10.0.22621
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0, 5.0, 5.1, 6.0, 7.0}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Other information
No response