Skip to main content

entra user license add

Assigns a license to a user

Usage

m365 entra user license add [options]

Options

--userId [userId]

The ID of the user. Specify either userId or userName but not both.

--userName [userName]

User principal name of the user. Specify either userId or userName but not both.

--ids <ids>

A comma separated list of IDs that specify the licenses to add.

-h, --help [help]

Output usage information. Optionally, specify which section of command's help you want to see. Allowed values are options, examples, remarks, response, full. Default is options.

--query [query]

JMESPath query string. See http://jmespath.org/ for more information and examples.

-o, --output [output]

Output type. json, text, csv, md, none. Default json.

--verbose

Runs command with verbose logging.

--debug

Runs command with debug logging.

Remarks

info

The user must have a usageLocation value in order to assign a license to it.

Examples

Assign specific licenses to a specific user by UPN.

m365 entra user license add --userName "john.doe@contoso.com" --ids "45715bb8-13f9-4bf6-927f-ef96c102d394,bea13e0c-3828-4daa-a392-28af7ff61a0f"

Assign specific licenses from a specific user by ID.

m365 entra user license add --userId "5c241023-2ba5-4ea8-a516-a2481a3e6c51" --ids "45715bb8-13f9-4bf6-927f-ef96c102d394,bea13e0c-3828-4daa-a392-28af7ff61a0f"

Response

{
"businessPhones": [],
"displayName": "John Doe",
"givenName": null,
"jobTitle": null,
"mail": "John@contoso.onmicrosoft.com",
"mobilePhone": null,
"officeLocation": null,
"preferredLanguage": null,
"surname": null,
"userPrincipalName": "John@contoso.onmicrosoft.com",
"id": "eb77fbcf-6fe8-458b-985d-1747284793bc"
}
CTRL + M