How to bulk Invite guest users in Azure

In this Azure ad tutorial, we will discuss how to add bulk guest users in Azure AD B2B from the Azure portal and PowerShell.

Bulk Invite Guest Users Azure

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 the Microsoft Azure portal through a CSV file.

External users can have any type of account like Gmail.com, yahoo.com, or outlook.com.

  1. Log in to the Azure portal. You can create a free Azure account.
  2. Then, select the Azure active directory.
  3. Then Click on Users, which is under Manage.
add users in azure ad

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

azure ad bulk invite guest users

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

The CSV file looks like the following:

azure bulk invite guest users

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

bulk invite guest users azure

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

azure bulk invite external users

5. Click on Submit.

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

how to add bulk guest users in Azure AD

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

The users will appear as Guests in the Azure AD.

bulk create guest users azure ad

The users will receive the email invitations and 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 to display the File name, Status, Success, Failures, Total requests, etc.

from azure ad in the azure portal you use the bulk invite users operation

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

Azure AD bulk invite guest users using PowerShell

We can also use the PowerShell command New-AzureADMSInvitation to add bulk guest users in Azure AD B2B collaboration.

To work with PowerShell, ensure you have installed the latest version of the 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*
azure b2b

You can check the tutorial below on installing the AzureADPreview PowerShell module.

Once you install the AzureADPreview module, you must prepare the CSV file.

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 the following:

bulk invite guest users azure

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 in the screenshot below.

Add bulk users to azure ad group Powershell

You can check the users in Azure AD.

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

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

You may like the following Azure tutorials:

In this tutorial, we learned how to bulk invite Guest users to Azure AD using Azure Portal and PowerShell.

5 thoughts on “How to bulk Invite guest users in Azure”

  1. Hello, firstly id like to say this is a very good script. i have tried it and it has helped especially with Bulk guest user creations. one thing i have noticed is that i receive the below error after running the script. Any idea why?

    -InvitedUserMessageInfo : The term ‘-InvitedUserMessageInfo’ is not recognized as the name of a cmdlet, function,
    script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is
    correct and try again.
    At C:\Guest\GuestAccess.ps1:13 char:7
    + -InvitedUserMessageInfo $messageInfo `
    + ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : ObjectNotFound: (-InvitedUserMessageInfo:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

  2. So I’m wondering if you have an answer for what happens if one of the users in a csv is already a guest in Azure? Will you get an error or will it just send the invite again? Ideally I would hope it would error out for that line of the csv.

    • So just to test, I uploaded a csv, and just now i uploaded the same csv. no errors. When I look in azure, I only see one entry for each user, but just wondering if you had a definitive answer for this.

      Thanks!

  3. Hi, I want to try the bulk user invite but can not see any column with firstname and surname in the template. Is this not posible to do?

Comments are closed.