Why is assignLicense endpoint throwing "One or more properties of the user contains invalid values." using the Microsoft Graph API

Diego González Liarte 5 Reputation points
2025-06-14T20:39:50.5233333+00:00

I've created a Contoso tenant which has its own Users and Licenses. I tried using both the Graph Python SDK and normal HTTP requests and I get the same error every time, whether I assign or remove licenses.

In the following example where I try to remove an assigned license, I've checked many times that the license exists (it throws another error if it doesn't), that the license is assigned to the user (it throws another error when removing a license that the user does not have), and that the user is enabled.

Request:

POST https://graph.microsoft.com/v1.0/users/1d93d89f-fb4b-4861-8dad-b9b3a14359c7/assignLicense
{
  "addLicenses": [],
  "removeLicenses": [
    "18a4bd3f-0b5b-4887-b04f-61dd0ee15f5e"
  ]
}

Response:

{
    "error": {
        "code": "Request_BadRequest",
        "message": "One or more properties of the user contains invalid values.",
        "innerError": {
            "date": "2025-06-14T20:30:50",
            "request-id": "6a9adf05-66ea-45f4-91e6-7f3cc62ed209",
            "client-request-id": "6a9adf05-66ea-45f4-91e6-7f3cc62ed209"
        }
    }
}

I have the following permissions on my Azure App (I had the Least privileged but tried with Higher privileged, still same error)image

I have not changed anything about the users on any portal or via API, all users are the default users provided when you create a Contoso tenant.

I've seen that some people get the same "One or more properties of the user contains invalid values." error when trying to create users, but I'm not doing nothing like that. From the admin portal I can remove and assign licenses freely and I've tried all combinations: remove/assign via api on fresh user, remove on admin panel and assign with api, assign on admin panel and remove with api... but I get the exact same error all the time.

Thanks!

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

1 answer

Sort by: Most helpful
  1. Vasil Michev 119.1K Reputation points MVP Volunteer Moderator
    2025-06-15T06:05:37.6+00:00

    The request must be POST, not GET one.


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.