Tutorial: Bulk invite Microsoft Entra B2B collaboration users
Applies to: Workforce tenants External tenants (learn more)
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 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 Trial 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.
Invite guest users in bulk
Tip
Steps in this article might vary slightly based on the portal you start from.
Sign in to the Microsoft Entra admin center as at least a User Administrator.
Browse to Identity > Users > 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 to whom you want to send 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://myapplications.windowsazure.cn.
Note
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, File uploaded successfully appears. 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 are listed.
When the job completes, a notification appears indicating that the bulk operation succeeded.
Understand the CSV template
A template is available to help you invite Microsoft Entra guest users in bulk. Download and fill in the bulk upload CSV template, which looks something 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: The template includes a row of sample values for each column. Remove the examples row and replace it with your own entries.
Further 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
- Sign in to the Microsoft Entra admin center as at least a User Administrator.
- Browse to Identity > Users > All 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 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 -Environment China -ClientId 'YOUR_CLIENT_ID' -TenantId 'YOUR_TENANT_ID' -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.partner.onmschina.cn, where contoso.partner.onmschina.cn 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 Microsoft Entra admin center 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.partner.onmschina.cn"