Skip to content

Instantly share code, notes, and snippets.

@dev-kperera
Last active February 20, 2020 18:27
Show Gist options
  • Save dev-kperera/b0e48d2138b849123855879b48c2c1f8 to your computer and use it in GitHub Desktop.
Save dev-kperera/b0e48d2138b849123855879b48c2c1f8 to your computer and use it in GitHub Desktop.
CSV headers: InvitedUserEmailAddress, DispName, RedirectURL
$cred = Get-Credential
Connect-AzureAD -Credential $cred
$invitations = import-csv C:\data\invitations.csv
$messageInfo = New-Object Microsoft.Open.MSGraph.Model.InvitedUserMessageInfo
$messageInfo.customizedMessageBody = "Hey there! Check this out. I created an invitation through PowerShell"
foreach ($email in $invitations) {New-AzureADMSInvitation -InvitedUserEmailAddress $email.InvitedUserEmailAddress -InvitedUserDisplayName $email.Name -InviteRedirectUrl https://wingtiptoysonline-dev-ed.my.salesforce.com -InvitedUserMessageInfo $messageInfo -SendInvitationMessage $true}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment