Skip to content

Instantly share code, notes, and snippets.

@clairernovotny
Created March 29, 2017 12:37
Show Gist options
  • Save clairernovotny/86cf3d0fd1649d29d4edf6ee31c99b57 to your computer and use it in GitHub Desktop.
Save clairernovotny/86cf3d0fd1649d29d4edf6ee31c99b57 to your computer and use it in GitHub Desktop.
B2B Invites to VSTS

To invite external users into VSTS, we first need to add them to the AAD directory. We can do this today with PowerShell, but you need the right module installed.

Make sure you have the AzureADPreview module installed.

If you need it, from an admin powershell prompt, you can use: Install-Module AzureADPreview

To update it later: update-module AzureAdPreview To remove it once it hits the stable module: uninstall-module AzureAdPreview

If you have the AzureAD module already installed, you’ll likely get conflicts—best to remove it first with uninstall-module AzureAD.

To invite:

  1. Connect to Azure AD: Connect-AzureAD. Login with your AAD creds
  2. $newuser = New-AzureADMSInvitation -InvitedUserDisplayName "first last" -InvitedUserEmailAddress "the@email.com" -SendInvitationMessage $True -InviteRedirectUrl "https://<account>.visualstudio.com"
  3. You can view the properties then by just entering in $newuser, which will show you the status should you want to see it. You may need this for the invite redeem URL if their AAD sign in name is not their email address.
  4. You can check the acceptance status in the Azure Portal under AAD -> All Users -> search. In the user profile, you can see the "Source" property of either "Invited User", "External AAD" or "Microsoft Account." The first one means they haven’t accepted yet. Doesn’t seem to be a way to check the acceptance status with PowerShell yet.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment