Permission & Access Issues

Grant Read-Only Access to SharePoint Online Subsites with PowerShell

Aamir Naveed AkramAamir Naveed Akram Nov 25, 2026 869 views

Question details

Grant a user read-only access across a SharePoint Online site collection and its subsites, including subsites with unique permissions.

Grant Read-Only Access to SharePoint Online Subsites with PowerShell
Product
SharePoint Online
Device & OS
not provided
Scenario
An administrator wants to use PowerShell to give a user read access throughout a site collection.
Observed behavior
Permissions granted at the site collection root do not automatically apply to subsites that have broken permission inheritance.
Before you start

Use an account that can manage permissions and see every target subsite, and confirm that the user already exists in the tenant. Install PnP PowerShell in a supported PowerShell version and have an Entra ID app registration configured for interactive sign-in with the required delegated permissions and consent.

Solution 1Recommended

Add the user to Visitors groups with PnP PowerShell

Use this approach to add the user at the site collection root and at subsites with unique site permissions.

Subsites that inherit permissions receive access from their parent. A subsite with unique site permissions must be handled separately.

This approach assumes each target site's associated Visitors group provides the intended read-only access. Review the groups and their permission levels before adding the user.

1
Connect to the site collection

In PowerShell, install the module with Install-Module PnP.PowerShell -Scope CurrentUser if needed. Set the values for your environment, then connect: $site = 'https://contoso.sharepoint.com/sites/example'; $clientId = 'YOUR-APP-CLIENT-ID'; $user = 'user@contoso.com'; Connect-PnPOnline -Url $site -ClientId $clientId -Interactive.

2
Find unique-permission subsites

Run: $root = Get-PnPWeb; $targets = @($root.Url); foreach ($web in @(Get-PnPSubWeb -Recurse)) { Get-PnPProperty -ClientObject $web -Property HasUniqueRoleAssignments | Out-Null; if ($web.HasUniqueRoleAssignments) { $targets += $web.Url } }; $targets. Review the resulting URLs before continuing.

3
Review the Visitors groups

For each URL in the target list, open the site and go to Settings > Site permissions > Advanced permissions settings. Check that its associated Visitors group exists and has the intended Read permission; resolve any exceptions before running the next step.

4
Add the user to each group

Run: foreach ($url in $targets) { Connect-PnPOnline -Url $url -ClientId $clientId -Interactive; $group = Get-PnPGroup -AssociatedVisitorGroup; if ($group) { Add-PnPGroupMember -Group $group -LoginName $user; Write-Host "Added at $url" } else { Write-Warning "No associated Visitors group at $url" } }. Complete interactive sign-in when prompted and review any errors or warnings.

5
Verify effective access

On representative sites, open Settings > Site permissions > Advanced permissions settings and use Check Permissions for the user. Also test access to representative lists and files, especially where permissions have been customized.

Read access is not a restriction: Adding Read access does not remove higher permissions the user already has through another group or direct assignment. Lists, libraries, folders, and files with unique permissions also require separate review.
Free Microsoft Office alternative

Work with SharePoint documents using WPS Office

WPS Office is a free, lightweight Office alternative with a familiar interface for working with compatible documents. It can help users move between Office files with minimal disruption, but SharePoint permissions must still be managed in Microsoft 365.

Open and edit compatible documents obtained from SharePoint when your permissions allow itCompatible with Microsoft Office formats, including DOCX, XLSX, and PPTXFamiliar editing interface for an easier transition from Microsoft OfficeFree, lightweight office suite
QA img-9

Frequently Asked Questions

Will granting access at the site collection root cover every subsite?

It covers subsites that inherit permissions from the root. Subsites with unique permissions need their own access assignment or an assignment inherited from their nearest permitted parent.

Does the Visitors group always grant read-only access?

Not necessarily. In each target site, open Settings > Site permissions > Advanced permissions settings and verify the group's assigned permission level before adding the user.

Can a user still edit after being added to a Visitors group?

Yes. A separate direct permission or group membership may grant higher access. Use Check Permissions in the site's advanced permissions settings to investigate the user's effective access.

Does this script cover lists and files with unique permissions?

No. The script targets site-level permissions. Lists, libraries, folders, and files that have broken inheritance must be reviewed and handled separately.

Why might the script miss a subsite?

The account running Get-PnPSubWeb must be able to discover the subsite. Check the account's access and compare the output with your site's inventory before applying permissions.