Last active
February 20, 2020 18:27
-
-
Save dev-kperera/b0e48d2138b849123855879b48c2c1f8 to your computer and use it in GitHub Desktop.
CSV headers: InvitedUserEmailAddress, DispName, RedirectURL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# connect | |
$cred = Get-Credential | |
Connect-AzureAD -Credential $cred | |
# setting variables | |
$invitations = import-csv ..\invitations.csv | |
$messageInfo = New-Object Microsoft.Open.MSGraph.Model.InvitedUserMessageInfo | |
$messageInfo.customizedMessageBody = "Hey there! Check this out. I created an invitation through PowerShell" | |
# loop | |
foreach ($email in $invitations) { | |
New-AzureADMSInvitation -InvitedUserEmailAddress $email.InvitedUserEmailAddress -InvitedUserDisplayName $email.DispName -InviteRedirectUrl $email.RedirectURL -InvitedUserMessageInfo $messageInfo -SendInvitationMessage $true | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment