cli-microsoft365 icon indicating copy to clipboard operation
cli-microsoft365 copied to clipboard

New command: Create guest user in the tenant

Open arjunumenon opened this issue 2 years ago β€’ 9 comments

Usage

m365 aad user guest add

Description

A Command to create guest user in the Tenant

Options

Option Description
--emailAddress <emailAddress> Email address of the Guest User
--displayName [displayName] Display name of the Guest User
--sendInvitationMessage Specify if you want to send invitation message while inviting the Guest user. If not specified, email will not be sent by Azure AD
--inviteRedirectUrl [inviteRedirectUrl] Redirect URL which will be there in the Invite message. If not specified, default URL https://myapplications.microsoft.com will be set.
--welcomeMessage [welcomeMessage] Personal welcome message which will be added in the email along with the default Email.

Additional Info

More details on the API : https://docs.microsoft.com/en-us/graph/api/invitation-post?view=graph-rest-1.0&tabs=http

arjunumenon avatar May 13 '22 14:05 arjunumenon

Hello @pnp/cli-for-microsoft-365-maintainers - Any suggestions to the spec for creating the guest user.

arjunumenon avatar May 13 '22 14:05 arjunumenon

What about extra optional options like firstName, lastName and personalMessage (in case sendInvitationMessage is true?)

martinlingstuyl avatar May 13 '22 14:05 martinlingstuyl

As of now in the InvitationObject there are no properties available for firstname, lastname etc. But personalMessage option is something which could be added along with the options. Nice suggestion πŸ‘.

arjunumenon avatar May 13 '22 14:05 arjunumenon

That's true, but we can probably modify the user object after the user invitation has been created. That being said, the firstname and lastname properties are not that important to me. So maybe just exlcude them.

martinlingstuyl avatar May 13 '22 15:05 martinlingstuyl

Great suggestion! Shall we change sendInvitationMessage to a flag as we don't need an explicit false on it? Also, I noticed it's included twice in the list of options: is there a reason for it?

waldekmastykarz avatar May 13 '22 17:05 waldekmastykarz

great idea πŸ‘ I was wondering if it is also possible to include those properties from invitation object as well πŸ‘‰https://docs.microsoft.com/en-us/graph/api/resources/invitation?view=graph-rest-1.0 image

what do you think πŸ€”?

Adam-it avatar May 13 '22 20:05 Adam-it

inviteRedirectUrl is required so it seems like something we need to have. inviteRedeemUrl is read-only so I'm not sure if we can do anything with it. What would be the use case for setting the status (assuming that it's even possible)?

waldekmastykarz avatar May 14 '22 18:05 waldekmastykarz

yes.. I guess from the marked params only inviteRedirectUrl makes sense πŸ™‚πŸ‘

Adam-it avatar May 14 '22 21:05 Adam-it

Thanks for the review on the specs.

Shall we change sendInvitationMessage to a flag as we don't need an explicit false on it? Also, I noticed it's included twice in the list of options: is there a reason for it?

Have updated sendInvitationMessage to be a flag which make sense rather than having a boolean one πŸ‘. Duplicate options was because of a "copy-paste" error. My bad πŸ€¦β€β™‚οΈ. Have updated the specs.

I was wondering if it is also possible to include those properties from invitation object as well

Like commented by Waldek rest of the options seems to be either Read-only or not applicable and hence have avoided those.

Making the issue available to be picked up.

arjunumenon avatar May 16 '22 07:05 arjunumenon

Am I missing something, or is welcomeMessage not in the API docs? 😊

milanholemans avatar Oct 22 '22 22:10 milanholemans

Am I missing something, or is welcomeMessage not in the API docs? 😊

Guess the properties are there here, where you can setup welcome message. There is a property called invitedUserMessageInfo in the request props if I am not mistaken

arjunumenon avatar Oct 23 '22 03:10 arjunumenon

Aw my bad, I read sendInvitationMessage as invitationMessage and was a bit confused what the difference was with welcomeMessage. My bad, sorry for the hassle πŸ˜ƒ

milanholemans avatar Oct 23 '22 11:10 milanholemans

Aw my bad, I read sendInvitationMessage as invitationMessage and was a bit confused what the difference was with welcomeMessage. My bad, sorry for the hassle πŸ˜ƒ

No problem at allπŸ‘. Always good to ask questions when in doubt before starting development.

arjunumenon avatar Oct 25 '22 02:10 arjunumenon