Skip to content

Instantly share code, notes, and snippets.

@f-bader
Created January 29, 2018 15:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save f-bader/61059ae98dcdd4c99190aa7685c70d07 to your computer and use it in GitHub Desktop.
Save f-bader/61059ae98dcdd4c99190aa7685c70d07 to your computer and use it in GitHub Desktop.
Create invite URL for Azure B2B
# Use Azure AD Username
$User = "AzureUsername"
$TargetTenant = "TargetTenant"
# Login
$Cred = Get-Credential
Connect-AzureAD -Credential $cred
# Generate Invitation, but do not send
$Invitation = New-AzureADMSInvitation -InvitedUserEmailAddress $User -InvitedUserDisplayName $User -InviteRedirectUrl "https://portal.azure.com/$($TargetTenant)" -SendInvitationMessage $false
# Copy redeem URL to clipboard
$Invitation | Select-Object –ExpandProperty InviteRedeemUrl | clip
# Send the URL to the user.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment