In this Azure PowerShell article, we will discuss the syntax and the usage of the New-AzureADMSInvitation PowerShell command with examples of how to use this command.
Table of Contents
New-AzureADMSInvitation
This is an excellent Azure PowerShell command that can help you to invite an external user to your Azure Active directory.
Syntax
Below is the syntax of the New-AzureADMSInvitation PowerShell command.
New-AzureADMSInvitation
-InvitedUserEmailAddress <String>
[-SendInvitationMessage <Boolean>]
-InviteRedirectUrl <String>
Let’s discuss a few examples of how to use the New-AzureADMSInvitation PowerShell command.
Example
You can execute the below Azure PowerShell command to invite the user xyz@tsm.com to your Azure AD.
Connect-AzureAD -TenantId 5d9d690a-0310-474d-ae8b-42df2d549228
New-AzureADMSInvitation -InvitedUserEmailAddress xyz@tsm.com -SendInvitationMessage $True -InviteRedirectUrl "http://myapps.microsoft.com"
After executing the above PowerShell command, I got the below output.
PS C:\WINDOWS\system32> Connect-AzureAD -TenantId 5d9d690a-0310-474d-ae8b-42df2d549228
New-AzureADMSInvitation -InvitedUserEmailAddress xyz@tsm.com -SendInvitationMessage $True -InviteRedirectUrl "http://myapps.microsoft.com"
Account Environment TenantId TenantDomain AccountType
------- ----------- -------- ------------ -----------
fewlines4biju@hotmail.com AzureCloud 5d9d690a-0310-474d-ae8b-42df2d549228 fewlines4bijuhotmail.onmicrosoft.com User
Id : 2344a65a-8c9a-4dfe-9dd8-8a513dc4ad56
InvitedUserDisplayName :
InvitedUserEmailAddress : xyz@tsm.com
SendInvitationMessage : True
InviteRedeemUrl : https://login.microsoftonline.com/redeem?rd=https%3a%2f%2finvitations.microsoft.com%2fredeem%2f%3ftenant%3d5d9d690a-0310-474d-ae8b
-42df2d549228%26user%3d2344a65a-8c9a-4dfe-9dd8-8a513dc4ad56%26ticket%3dxuSRxqfrejMGY3uARsyjvK2BHI23OnA2ntBiVbhhp9k%25253d%26ver%3d
2.0
InviteRedirectUrl : http://myapps.microsoft.com/
InvitedUser : class User {
Id: dad56ad9-fc4d-4586-8ce6-5c7e99602d0a
OdataType:
}
InvitedUserMessageInfo : class InvitedUserMessageInfo {
CcRecipients: System.Collections.Generic.List`1[Microsoft.Open.MSGraph.Model.Recipient]
CustomizedMessageBody:
MessageLanguage:
}
InvitedUserType : Guest
Status : PendingAcceptance
ResetRedemption : False
You can see the same output below

Then I logged in to the Azure Portal and could see the guest user and could able to see a successful entry for the same.

You can also check out below video tutorial on the New-AzureADMSInvitation PowerShell Command.
You may also like following the below articles
Final Thoughts
In this Azure article, we discussed the syntax and the usage of the New-AzureADMSInvitation PowerShell command with examples of how to use this command.