Set-MgUserLicense Error message

Kathryn Anderson 0 Reputation points
2025-03-07T15:45:18.94+00:00

I have been trying to get Set-MgUserLicense to work for days now but every time I run this script I get this error message.

Set-MgUserLicense : One or more parameters of the operation 'assignLicense' are missing from the request payload. The missing parameters are: removeLicenses

I have not changed anything with my script, it just stopped working. Is there an issue with Set-MgUserLicense? I really need to get this working again as it is vital to how we work and assign new users licenses.

Thanks

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
13,212 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Rajat Vashistha-MSFT 1,150 Reputation points Microsoft External Staff
    2025-03-07T17:19:12.42+00:00

    Hi Kathryn Anderson,

    Thanks for reaching out to Microsoft!

    The error message you’re encountering with Set-MgUserLicense indicates that the removeLicenses parameter is missing from the request payload. When using this cmdlet, both -AddLicenses and -RemoveLicenses parameters need to be explicitly provided, even if one of them is empty.

    If you don’t have any licenses to remove, please try including the -RemoveLicenses @() parameter in your command and check if it resolves the issue.

    You can refer to the relevant documentation for more details: Set-MgUserLicense

    Hope this helps.

    If the answer is helpful, please click Accept Answer and kindly upvote. If you have any further questions about this answer, please click Comment.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.