PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,943 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I need some ps code preference for my project.
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
Connect-AzureAD
# Set the required parameters
$displayName = "SD Test"
$emailAddress = "******@domain.com"
$customInvitationMethod = "CustomMethod"
$customizedMessageBody = "This is a Test Custom Message Body"
# Create the invitation
$invitation = New-AzureADMSInvitation -InvitedUserDisplayName $displayName -SendInvitationMessage $True -InvitedUserEmailAddress $emailAddress -InviteRedirectUrl "https://myapplications.microsoft.com" -InvitedUserMessageInfo @{ "MessageLanguage" = "en-US"; "CustomizedMessageBody" = $customizedMessageBody } -InvitedUserType Guest
# Display the invitation details
$invitation
PS Output:
Invitation sample:
Please "Accept the answer" if the information helped you. This will help us and others in the community as well.