Add multiple users in a SharePoint site

A few days ago, I had a request to add multiple users in a SharePoint site but using the default interface, I can only add one by one. If we have a long list of users that need to be added to the site this tasks can take a while. So I come up with a PowerShell that will do this task based on a CSV file that contains the email that will make this process faster

For this PowerShell, I will use the PnP PowerShell but you can achieve the same using Microsoft 365 CLI.

Note: For the authentication piece, I will use the PnPManagementShell rather than the UseWebLogin traditional method. You can read more about it on the following link:

If you want to know the level of permission needs to accept the PnP Application on your tenant, check the following link:

$siteUrl = ""
Connect-PnPOnline -Url $siteUrl -PnPManagementShell -LaunchBrowser

Write-Host "Adding External Users"
$UsersToImport = Import-Csv -Path ".\Users.csv"
$MembersGroup = Get-PnPGroup -AssociatedMemberGroup

foreach ($user in $UsersToImport) {
    Write-Host "Adding User Email" $
    Add-PnPUserToGroup -EmailAddress $ -Identity $MembersGroup #-SendEmail

You can adjust the PnP group that you want to add the users on (SharePoint groups). If you don’t know the user that needs to be added to the site it’s also easy for everyone to send you this CSV file or similar so you can apply to the SharePoint site. You can also include the role that you want on this CSV file and therefore add the users to the desired places.


  1. Raphael said:

    It works to add many users to a SharePoint list?

    June 11, 2021
    • David Ramalho said:


      This will allow the users to access your SharePoint list if the permissions are the default ones. If the permissions are broken on the list you may need to adjust the code for that case.

      My best,
      David Ramalho

      October 21, 2021
  2. Rose Fletcher said:

    What if you want to add a user to multiple sites with a CSV file, with PNP How can you add the commands, the Connect-PNP -URL $URL -Interactive and then Set-PNPWebPermissions on the next line? I have a CSV File with 8000 users, multiple sites, and different roles. My CSV File is : URL, User, Role. I can not get the ForEach in a loop to format / syntax correct.

    February 22, 2024

Leave a Reply

Your email address will not be published. Required fields are marked *