
Note: The account to be used in the PowerShell should be the administrator of these site collections.
1.Create a csv file as following picture shows.
2.Please run below PowerShell.
$Credentials=Get-Credential
$DomainGroup = "******@domain.com"
$PermissionLevel = "Contribute"
$filePath = “the local path of csv file, such as C:\sites.csv”
$csv = Import-Csv $filePath
$a = $csv.Url
ForEach($_ in $a) {
Connect-pnponline $_ -Credential $Credentials
Set-PnPWebPermission -User $DomainGroup -AddRole $PermissionLevel -Identity "/"
}
If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.