How to add bulk guest users in Azure AD B2B from Azure Portal and PowerShell

In this Azure ad tutorial, we will discuss how to add bulk guest users in Azure AD B2B from the Azure portal, also we will discuss how to add bulk users in Azure ad B2B collaboration using Powershell.

We can use Azure active directory B2B collaboration to work with vendors or external partners. Here we can invite bulk guest users to our organization.

Add bulk users in Azure AD B2B Collaboration from Azure Portal

Microsoft allows us to add bulk users in Azure ad B2B collaboration from Microsoft Azure portal throw a csv file.

The external users can have any type of account like Gmail.com or yahoo.com or outlook.com.

Login to Azure portal. You can create a free Azure account.

Then select Azure active directory.

Then Click on Users  which is under Manage.

add users in azure ad

This will display all the users, here click on Bulk invite, which will display bulk invite users page and an option to download a template, it is a CSV file.

add bulk guest users in Azure AD B2B

 This is basically a sample or template which you can modify and upload here. Here you can add all your guest users you want to invite.

The csv file looks like below:

add bulk guest users in Azure AD B2B collaboration

You can modify and add all the guest users you want to invite.

add bulk guest users in Azure AD B2B from Azure Portal

Once the CSV file is ready, upload it like below:

How to add bulk guest users in Azure AD B2B from Azure Portal

Click on Submit.

Once it is done, it will show a successful message like below:

how to add bulk guest users in Azure AD

You can also click on “Click here to view the status of each operation” link to check the status of each request.

The users will appear as a Guests in the Azure AD.

guest users in azure ad

The users will receive the email invitations and they can accept the invitation.

Check Bulk Operations Results

You can also check the bulk operations results. Click on Bulk operation results from the left navigation and it will display the File name, Status, Success, Failures, Total requests etc.

azure ad bulk operation results

This is how we can add bulk guest users in Azure AD B2B collaboration from Azure Portal.

Add bulk users in Azure AD B2B Collaboration using PowerShell

We can also use PowerShell to add bulk guest users in Azure AD B2B collaboration.

To work with PowerShell, make sure you have installed the latest version of AzureADPreview module.

Install-Module AzureADPreview

You can also run the below command to check which AzureAD PowerShell module has been installed in your system.

Get-Module -ListAvailable AzureAD*
Check which AzureADPreview module installed

You can check the below tutorial on how to install AzureADPreview PowerShell module.

Once you install the AzureADPreview module, next you need to make the CSV file ready.

Create a CSV file with the following columns:

  • Name
  • InvitedUserEmailAddress

You can create an excel and save the file in .csv format in your system drive. The excel file looks like below:

add bulk guest users in Azure AD B2B csv template

Now, run the below PowerShell command in PowerShell ISE to add bulk guest users in Azure AD B2B using PowerShell.

Connect-AzureAD -TenantDomain "SPSkyTraining.onmicrosoft.com"
$csvfilepath = import-csv e:\Bijay\BulkUsers.csv

$messageInfo = New-Object Microsoft.Open.MSGraph.Model.InvitedUserMessageInfo

$messageInfo.customizedMessageBody = "Hello. Join TSInfo Team."

foreach ($email in $csvfilepath)
   {New-AzureADMSInvitation `
      -InvitedUserEmailAddress $email.InvitedUserEmailAddress `
      -InvitedUserDisplayName $email.Name `
      -InviteRedirectUrl https://myapps.microsoft.com `
      -InvitedUserMessageInfo $messageInfo `
      -SendInvitationMessage $true
   }

You can see the invites like below:

invite bulk guest users in Azure AD B2B using PowerShell

You can check the users in Azure AD.

Or also, you can check the guest users in Microsoft 365 admin center.

how to invite bulk guest users in Azure AD B2B using PowerShell

You may like following Azure tutorials:

In this tutorial, we learned how to invite bulk guest users in Azure AD collaboration using PowerShell.

Leave a Comment