Fix Invalid Microsoft 365 License Assignment Errors
Question details
Resolve an invalid-license error when assigning a Microsoft 365 license to a user.

- Product
- Microsoft 365
- Device & OS
- not provided
- Scenario
- An administrator is assigning a Microsoft 365 license to a user, including through PowerShell.
- Observed behavior
- The assignment reports an invalid-license error even though the SKU exists and has available units. The user's usage location may be missing.
Confirm that you have an administrator role permitted to update users and assign licenses. Identify the user's actual country or region and its two-letter ISO 3166-1 code, such as US.
Set the User's Usage Location and Assign the License
Use the admin centers to correct a missing usage location and retry the assignment without PowerShell.
In the Microsoft Entra admin center, go to Identity > Users > All users and select the affected user.
Open Properties, select Edit properties, and set Usage location to the user's actual country or region. Save the change.
In the Microsoft 365 admin center, go to Users > Active users, select the user, and open Licenses and apps. Select the appropriate license and save your changes.
Reopen the user's Licenses and apps tab to confirm that the license is assigned. If it still fails, check that the subscription has an available license and review any displayed error.

Set Usage Location and Assign the License with Microsoft Graph PowerShell
Use Microsoft Graph PowerShell to check and update the user's location, then retry the license assignment.
Work with Office Files Using WPS Office
WPS Office is a free, lightweight alternative with a familiar interface for working with Office files. Its format compatibility helps make migration straightforward, although it does not fix Microsoft 365 license assignment errors.

Frequently Asked Questions
Why does a license assignment fail when the SKU has available units?
A missing or invalid usage location can prevent assignment even when licenses are available. Check the user's Usage location in Microsoft Entra admin center under Identity > Users > All users > Properties.
What value should I use for UsageLocation in PowerShell?
Use the user's actual country or region as a two-letter ISO 3166-1 code, such as US. Set it with Update-MgUser -UserId 'user@contoso.com' -UsageLocation 'US'.
Can I still use Set-MsolUserLicense?
Set-MsolUserLicense belongs to the retired MSOnline PowerShell module. Use Set-MgUserLicense from Microsoft Graph PowerShell for current license-assignment scripts.
Where can I check whether a Microsoft 365 license is available?
In the Microsoft 365 admin center, go to Billing > Licenses and select the product to review its license availability. In Microsoft Graph PowerShell, use Get-MgSubscribedSku to inspect SKU and unit information.




