Skip to content

Instantly share code, notes, and snippets.

@dev-kperera
Created February 20, 2020 18:24
Show Gist options
  • Save dev-kperera/7ed6a4b715c50f6d423b0524234965de to your computer and use it in GitHub Desktop.
Save dev-kperera/7ed6a4b715c50f6d423b0524234965de to your computer and use it in GitHub Desktop.
CSV headers
$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