Tutorial: Bulk invite Microsoft Entra B2B collaboration users

If you use Microsoft Entra 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 Microsoft Entra admin center 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 Microsoft Entra ID
  • Verify the users were added to the directory

Prerequisites

  • If you don’t have Microsoft Entra ID, 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

Tip

Steps in this article might vary slightly based on the portal you start from.

  1. Sign in to the Microsoft Entra admin center as at least a User Administrator.

  2. Browse to Identity > Users > All Users.

  3. Select Bulk operations > Bulk invite.

    Screenshot of the bulk invite button.

  4. On the Bulk invite users page, select Download to get a valid .csv template with invitation properties.

    Screenshot of the download the csv file button.

  5. Open the .csv template and add a line for each guest user. Required values are:

    Screenshot of the example csv file with guest users entered.

    Note

    Don't use commas in the Customized invitation message because they'll prevent the message from being parsed successfully.

  6. Save the file.

  7. 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.

  8. 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.

  9. When your file passes validation, select Submit to start the Azure bulk operation that adds the invitations.

  10. 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.

    Screenshot of the bulk operation results.

  11. 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 Microsoft Entra guest users in bulk. The CSV template you download might look like this example:

Spreadsheet for upload and call-outs explaining the purpose and values for each row and column

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.

Additional guidance

  • 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 Microsoft Entra admin center or by using PowerShell.

View guest users in the Microsoft Entra admin center

  1. Sign in to the Microsoft Entra admin center as at least a User Administrator.
  2. Browse to Identity > Users > All users.
  3. 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#EXT#@contoso.onmicrosoft.com, 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>"

For example: Remove-MgUser -UserId "lstokes_fabrikam.com#EXT#@contoso.onmicrosoft.com"

Next steps