Hi Rising Flight,
Please note that New-MsolUser
is used for creating a new user in Azure AD, not for inviting a guest user. You should use New-AzureADMSInvitation
A Sample:
|Invite the user:
$inv = New-AzureADMSInvitation -InvitedUserEmailAddress "someone@domain.com" -InvitedUserDisplayName "FN LN" -SendInvitationMessage $true -InviteRedirectUrl <URL> -InvitedUserType "Guest"
|Use this command to add the invited user to a group:
Add-AzureADGroupMember -ObjectId <GroupObjectId> -RefObjectId $inv.InvitedUser.Id
# If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".