Can I invite a guest user in azure active directory using powershell

This topic contains 2 replies, has 2 voices, and was last updated by  Deep 6 months, 1 week ago.

  • Author
  • #78773


    Hi All,

    I am trying to add an external user (user from another domain) into my Azure AD.
    I am able to perform the same from Azure ARM portal (through 'Add a guest user'). However, I am not able to perform the same using powershell.
    Any suggestion as to how this can be performed?

    Let me know if any further explanation is required.


  • #78836

    Don Jones

    I'm not sure they've presently exposed that functionality via PowerShell. In fact, after some cursory research, I'm not sure the underlying Graph API supports this, which means the portal might be the only supported mechanism. You'd have to open a support ticker with Azure to confirm.

  • #79222


    Hi Don,

    Thank you for your reply.
    By using AzureAD module this worked, however unable to assign a co-administrator role to the added user.

    Below is the script which I used for sending out an invitation.

    $email = Read-Host -Prompt 'Please provide the email Id of the user'
    $userName = Read-Host -Prompt 'Enter the User Name'

    Write-Host "Sending invitation to $userName " -f Green
    $messageInfo = New-Object Microsoft.Open.MSGraph.Model.InvitedUserMessageInfo
    $messageInfo.customizedMessageBody = “Hey $userName, `n Click on the Get Started link to start exploring”
    New-AzureADMSInvitation -InvitedUserEmailAddress $email -InvitedUserDisplayName $userName -InviteRedirectUrl -InvitedUserMessageInfo $messageInfo -SendInvitationMessage $true
    Write-Host "Invitation sent successfully" -f Green

You must be logged in to reply to this topic.