Many admins have reported that they couldn’t assign or remove licenses using the Microsoft Graph PowerShell cmdlet Set-MgUserLicense, encountering the error:
Set-MgUserLicense : One or more parameters of the operation ‘assignLicense’ are missing from the request payload.
I’ve received similar feedback from users in one of my PowerShell scripts: Microsoft 365 license management and reporting which covers 10+ M365 license reporting, assignment, and removal operations. Upon checking in my test environment, I noticed that some users could assign M365 licenses without issues, while others consistently faced this error.
After digging deeper, it turned out to be an issue introduced in the latest version(s) of the Microsoft Graph PowerShell module.
Despite many discussions and questions in technical forums, Microsoft hasn’t yet provided an official fix or workaround.
How to Resolve ‘Set-MgUserLicense : One or more parameters of the operation ‘assignLicense’ are missing’ Error
After testing a few methods, I’ve found two reliable workarounds. You can choose the one that best fits your environment:
1. Downgrade to Microsoft Graph PowerShell Module 2.23.0
The issue seems to have been introduced in versions after 2.23.0. So, downgrading to this version resolves the problem.
Use the following command to install Microsoft Graph version 2.23.0:
1 |
Install-Module Microsoft.Graph -Scope CurrentUser -RequiredVersion 2.23.0 |
Note: Make sure to uninstall other versions before installing. Having multiple versions installed may cause conflicts and introduce ‘one or more errors occurred’ while running MS Graph cmdlets.
2. Assign or Remove License UsingMicrosoft Graph API
If you prefer sticking with the latest module or want more control, you can use a direct API call via Invoke-MgGraphRequest.
Assign license to a single user:
To assign a specific license to a user, use the below code.
1 2 3 4 5 6 7 |
$body = @{ AddLicenses = @( @{skuId = "<SkuID>"} ) RemoveLicenses = @() } Invoke-MgGraphRequest POST "v1.0/users/<UPN>/assignLicense" -Body $body |
Here, replace <SkuID> and <UPN> to assign a specific license to a user.
To assign a license for bulk Microsoft 365 users:
To assign license to multiple users by importing CSV file, you can use the below code:
1 2 3 4 5 6 7 8 9 10 11 |
$UserNames = Import-Csv <FilePath> foreach ($User in $UserNames) { $UserId = $User.UPN $body = @{ AddLicenses = @( @{ skuId = <SkuId> } ) RemoveLicenses = @() } Invoke-MgGraphRequest POST "v1.0/users/$UserId/assignLicense" -Body $body } |
Replace <SkuID> and <FilePath> with your license GUID and CSV file path respectively.
Note: The CSV file should contain the users’ User Principal Names in a column named “UPN”.
Similarly to remove license, you need to pass the SkuId in the “RemoveLicenses” param in the body param. For example,
1 2 3 4 |
$body = @{ AddLicenses = @() RemoveLicenses = @(<SkuId>) } |
Common Errors Addressed:
Set-MgUserLicense : One or more parameters of the operation ‘assignLicense’ are missing. The missing parameters are: remove licenses
Set-MgUserLicense : One or more parameters of the operation ‘assignLicense’ are missing. The missing parameters are: assign licenses
I hope this guide helps you resolve these common licensing assignment errors in Microsoft 365. If you have any questions or need help troubleshooting, feel free to drop them in the comments below.