Invite Guest users with custom invitation message in AAD using a powershell

Kerwin Rean Kallego 61 Reputation points

I need some ps code preference for my project.

A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,310 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
20,540 questions
0 comments No comments
{count} votes

Accepted answer
  1. Harpreet Singh Matharoo 7,621 Reputation points Microsoft Employee

    Hello @Kerwin Rean Kallego ,

    Thank you for reaching out this. We can send guest invites using Azure AD PowerShell module using following script:

    # Install the AzureAD module if not already installed 
    Install-Module -Name AzureAD  
    # Import the AzureAD module 
    Import-Module AzureAD  
    # Connect to Azure AD 
    # Set the required parameters 
    $displayName = "SD Test" 
    $emailAddress = "" 
    $customInvitationMethod = "CustomMethod" 
    $customizedMessageBody = "This is a Test Custom Message Body"  
    # Create the invitation 
    $invitation = New-AzureADMSInvitation -InvitedUserDisplayName $displayName -SendInvitationMessage $True -InvitedUserEmailAddress $emailAddress -InviteRedirectUrl "" -InvitedUserMessageInfo @{ "MessageLanguage" = "en-US"; "CustomizedMessageBody" = $customizedMessageBody } -InvitedUserType Guest   
    # Display the invitation details 

    PS Output:
    User's image

    Invitation sample:
    User's image

    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.

    0 comments No comments

0 additional answers

Sort by: Most helpful