I need to create Azure AD users in bulk (about 90), in order to add each of them:

  • To a SharePoint group present in 90 sub-sites
  • Authorizations from two libraries in each of these sub-sites

Example :

Etc Etc Etc..... Up to 90.

The idea would be to create a PowerShel script based on a CSV file with the necessary information: UPN > Sharepoint link > Sharepoint group name > Document library names > Name of the specific authorization level.

I don't really master scripting and I don't know much about the powershell functions related to Sharepoint. After some research, I find information but it doesn't really correspond to my needs.

Can you help me ?


  • Hello, I share my research : Mass creation of Azura AD users: $users = Import-Csv C:\O365_EA_Users.csv $users | ForEach-Object { New-MsolUser -UserPrincipalName $_.UserPrincipalName -DisplayName $_.DisplayName -FirstName $_.FirstName -LastName $_.LastName -Password $_.Password } Adding these users to the "Visitors" groups of each sub-site: $users = Import-Csv C:\O365_EA_UsersToGroupSP_2.csv $users | ForEach-Object { Add-SPOUser - Site $_.Subsite -LoginName $_.UserPrincipalName -Group $_.Group } Anyone to help me add users to document library permissions ?
    – NonoCHÉ
    Commented May 21, 2019 at 14:37

2 Answers 2


Looks like you can already create the users and add them to groups, why not create a group in the permissions for each document library with the "Special auth" permissions level, and add the user to that group?


Having integrated users into the visitor group of each sub-site, I ended up adding this group to the permissions of the two document libraries of each sub-site (there is obviously no powershell function to add users, only groups, and thinking about it, it is wise to proceed like that for future evolution in permissions)

$group = Import-Csv C:\O365_EA_GrouptoPermissionList.csv

$group | ForEach-Object {
Connect-PnPOnline $_.url -Credential $userCred;
Set-PnPGroupPermissions -identity $_.groupname -List $_.library1 -AddRole "MySpecialPermission";
Set-PnPGroupPermissions -identity $_.groupname -List $_.library2 -AddRole "MySpecialPermission"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.