Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New command: aad user license add #4504

Closed
Tracked by #4496
milanholemans opened this issue Feb 11, 2023 · 16 comments
Closed
Tracked by #4496

New command: aad user license add #4504

milanholemans opened this issue Feb 11, 2023 · 16 comments

Comments

@milanholemans
Copy link
Contributor

milanholemans commented Feb 11, 2023

Usage

m365 aad user license add [options]

Description

Assigns subscriptions to a user

Options

Option Description
--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.

Examples

Assign specific licenses to a specific user by UPN

m365 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 user license add --userId "5c241023-2ba5-4ea8-a516-a2481a3e6c51" --ids "45715bb8-13f9-4bf6-927f-ef96c102d394,bea13e0c-3828-4daa-a392-28af7ff61a0f"

Default properties

No response

Additional Info

API docs: https://learn.microsoft.com/en-us/graph/api/user-assignlicense?view=graph-rest-1.0&tabs=http

Docs

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

@milanholemans milanholemans added new feature needs peer review Needs second pair of eyes to review the spec or PR labels Feb 11, 2023
@martinlingstuyl
Copy link
Contributor

Hi @milanholemans, looks great!
One question: how would a user know where to get the ids?

@milanholemans
Copy link
Contributor Author

Hi @martinlingstuyl, I've created a command for that as well #4503

@martinlingstuyl
Copy link
Contributor

We could also split it into two commands:

user license add
user license remove

@martinlingstuyl
Copy link
Contributor

Hi @martinlingstuyl, I've created a command for that as well #4503

Ahh, I looked in the epic, it wasn't there.

@milanholemans
Copy link
Contributor Author

Ahh, I looked in the epic, it wasn't there.

Yeah I didn't include it there because it's not really related to AAD users.

@martinlingstuyl
Copy link
Contributor

We could also split it into two commands:

user license add
user license remove

So what about this @milanholemans?

@milanholemans
Copy link
Contributor Author

We could also split it into two commands:

user license add user license remove

At first I thought the same. On the other hand I found it weird that we are splitting the functionality of 1 API endpoint over 2 commands. Why would I make 2 requests if I can do it into 1.

@martinlingstuyl
Copy link
Contributor

I'm primarily thinking if its user friendly enough. Using add/remove would fit better with how we do things normally, instead of having these oddly named add and remove options.

What do you think @pnp/cli-for-microsoft-365-maintainers?

@Adam-it
Copy link
Contributor

Adam-it commented Feb 13, 2023

hmm good question. set would indicate (at least for me) that I am either setting a new value or modifying an existing one (like , for sure not removing any 😉, so what @martinlingstuyl proposed is quite valid comment for sure 👍.
@pnp/cli-for-microsoft-365-maintainers any more opinions ?

@milanholemans
Copy link
Contributor Author

In that case I can follow you in that. set means that you specifically define the new state of an object.

@milanholemans milanholemans changed the title New command: aad user license set New command: aad user license add Feb 13, 2023
@milanholemans
Copy link
Contributor Author

@martinlingstuyl @Adam-it updated the specs, could you have another look?

@martinlingstuyl
Copy link
Contributor

martinlingstuyl commented Feb 14, 2023

I'd say: let's make the option name singular, eg id. Just as with the options in this command where multiple values can be added.. @milanholemans

@martinlingstuyl
Copy link
Contributor

Other than that it looks great 👏

@milanholemans milanholemans added help wanted needs design and removed needs peer review Needs second pair of eyes to review the spec or PR help wanted needs design labels Feb 14, 2023
@nicodecleyre
Copy link
Contributor

Can I work on this?

@Adam-it
Copy link
Contributor

Adam-it commented Feb 16, 2023

✅👍💪🚀🤩

@nicodecleyre
Copy link
Contributor

Just wondering, would it be helpfull to add an extra option names or partNumbers where the user can give a commaseperated list of the license names one would like to add?

It would require an extra api call, but it would make the command more practical to use

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants