Tutorial: Bulk invite Azure AD B2B collaboration users
If you use Azure Active Directory (Azure AD) B2B collaboration to work with external partners, you can invite multiple guest users to your organization at the same time. In this tutorial, you learn how to use the Azure portal to send bulk invitations to external users. Specifically, you'll follow these steps:
- Use Bulk invite users to prepare a comma-separated value (.csv) file with the user information and invitation preferences
- Upload the .csv file to Azure AD
- Verify the users were added to the directory
If you don’t have Azure Active Directory, create a free account before you begin.
You need two or more test email accounts that you can send the invitations to. The accounts must be from outside your organization. You can use any type of account, including social accounts such as gmail.com or outlook.com addresses.
Invite guest users in bulk
Sign in to the Azure portal with an account that is a global administrator in the organization.
In the navigation pane, select Azure Active Directory.
Under Manage, select All Users.
Select Bulk operations > Bulk invite.
On the Bulk invite users page, select Download to get a valid .csv template with invitation properties.
Open the .csv template and add a line for each guest user. Required values are:
Email address to invite - the user who will receive an invitation
Redirection url - the URL to which the invited user is forwarded after accepting the invitation. If you want to forward the user to the My Apps page, you must change this value to https://myapps.microsoft.com or https://myapplications.microsoft.com.
Don't use commas in the Customized invitation message because they'll prevent the message from being parsed successfully.
Save the file.
On the Bulk invite users page, under Upload your csv file, browse to the file. When you select the file, validation of the .csv file starts.
When the file contents are validated, you’ll see File uploaded successfully. If there are errors, you must fix them before you can submit the job.
When your file passes validation, select Submit to start the Azure bulk operation that adds the invitations.
To view the job status, select Click here to view the status of each operation. Or, you can select Bulk operation results in the Activity section. For details about each line item within the bulk operation, select the values under the # Success, # Failure, or Total Requests columns. If failures occurred, the reasons for failure will be listed.
When the job completes, you'll see a notification that the bulk operation succeeded.
Understand the CSV template
Download and fill in the bulk upload CSV template to help you successfully invite Azure AD guest users in bulk. The CSV template you download might look like this example:
CSV template structure
The rows in a downloaded CSV template are as follows:
- Version number: The first row containing the version number must be included in the upload CSV.
- Column headings: The format of the column headings is <Item name> [PropertyName] <Required or blank>. For example,
Email address to invite [inviteeEmail] Required. Some older versions of the template might have slight variations.
- Examples row: We've included in the template a row of examples of values for each column. You must remove the examples row and replace it with your own entries.
- The first two rows of the upload template must not be removed or modified, or the upload can't be processed.
- The required columns are listed first.
- We don't recommend adding new columns to the template. Any columns you add are ignored and not processed.
- We recommend that you download the latest version of the CSV template as often as possible.
Verify guest users in the directory
Check to see that the guest users you added exist in the directory either in the Azure portal or by using PowerShell.
View guest users in the Azure portal
- Sign in to the Azure portal with an account that is a User administrator in the organization.
- In the navigation pane, select Azure Active Directory.
- Under Manage, select Users.
- Under Show, select Guest users only and verify the users you added are listed.
View guest users with PowerShell
To view guest users with PowerShell, you'll need the Microsoft.Graph.Users PowerShell Module. Then sign in using the
Connect-MgGraph command with an admin account to consent to the required scopes:
Connect-MgGraph -Scopes "User.Read.All"
Run the following command:
Get-MgUser -Filter "UserType eq 'Guest'"
You should see the users that you invited listed, with a user principal name (UPN) in the format emailaddress#EXT#@domain. For example, lstokes_fabrikam.com#EXTfirstname.lastname@example.org, where contoso.onmicrosoft.com is the organization from which you sent the invitations.
Clean up resources
When no longer needed, you can delete the test user accounts in the directory in the Azure portal on the Users page by selecting the checkbox next to the guest user and then selecting Delete.
Or you can run the following PowerShell command to delete a user account:
Remove-MgUser -UserId "<UPN>"
Remove-MgUser -UserId "lstokes_fabrikam.com#EXTemail@example.com"