Set-MgUserLicense not allowing adding license "No license changes provided"
I am able to remove licenses but trying to add the license returns the error "Set-MgUserLicense : No license changes provided. At least one license to add or remove must be specified."
Attempted several variations of SkuPartNumber lookup :
$EmsSku = Get-MgSubscribedSku -All | Where SkuPartNumber -eq 'EMSPREMIUM'
Set-MgUserLicense -UserId "******@domain.com" -AddLicenses @{SkuId = $EmsSku.SkuId} -RemoveLicenses @()
or using the SkuID:
Set-MgUserLicense -UserId "******@domain.com" -addlicenses @{SkuId = 'b05e124f-c7cc-45a0-a6aa-8cf78c946968'} -RemoveLicenses @()
Both return:
Set-MgUserLicense : No license changes provided. At least one license to add or remove must be specified.
Status: 400 (BadRequest)
ErrorCode: Request_BadRequest
Date: 2025-05-08T19:28:08
Headers:
Transfer-Encoding : chunked
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : e69823a9-c8b9-4e0a-85c9-9164ec8a0329
client-request-id : d2a95964-6160-40a5-a359-b7a1490a0f1d
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"North Central US","Slice":"E","Ring":"4","ScaleUnit":"004","RoleInstance":"CH01EPF0005D080"}}
x-ms-resource-unit : 1
Cache-Control : no-cache
Date : Thu, 08 May 2025 19:28:08 GMT
At line:1 char:1
- Set-MgUserLicense -UserId "******@liftow.com" -addlicenses @{S ...
-
+ CategoryInfo : InvalidOperation: ({ UserId = dan....ionJsonSchema }:<>f__AnonymousType0`3) [Set-MgUserLicense_AssignExpanded], Exception + FullyQualifiedErrorId : Request_BadRequest,Microsoft.Graph.PowerShell.Cmdlets.SetMgUserLicense_AssignExpanded