--- title: "Audit SharePoint Sites for Security Issues and Oversharing" slug: "dex-wf-audit-sharepoint-oversharing" updated: 2026-11-30T16:12:58Z published: 2026-11-30T16:12:58Z canonical: "documentation.sysaid.com/dex-wf-audit-sharepoint-oversharing" --- > ## Documentation Index > Fetch the complete documentation index at: https://documentation.sysaid.com/llms.txt > Use this file to discover all available pages before exploring further. # Audit SharePoint Sites for Security Issues and Oversharing Inventory every SharePoint site, flag "Everyone" and anonymous sharing, and produce a prioritized remediation report. **Complexity:** Intermediate. **Impact:** security + compliance + access-review + data-governance + sharepoint. ## Why use this workflow SharePoint Online is a common source of data oversharing in Microsoft 365 tenants. Over time, sites accumulate permissions that nobody remembers granting: "Everyone except external users" groups, stale guest accounts, anonymous sharing links that never expire, and site owners who left the company. This workflow walks through a tenant-wide audit of every SharePoint site, focusing on the highest-risk misconfigurations: wide-reaching internal access (Everyone groups), external and anonymous sharing, and missing or orphaned owners. Run it as part of your access review program, before a compliance audit (SOC 2, ISO 27001, HIPAA), or when you onboard a new security or data protection lead. ### When to run this workflow - Quarterly access reviews - Pre-audit preparation (SOC 2, ISO 27001, HIPAA) - After a security incident involving data exposure - When migrating from a file server to SharePoint - After enabling or disabling tenant-wide external sharing ## Expected outcomes ### After completing this workflow you will have: - A complete inventory of all SharePoint sites in the tenant (excluding OneDrive personal sites) - A CSV report listing each site's URL, owners, sharing capability, and flagged findings - A prioritized list of sites sharing with "Everyone" or "Everyone except external users" - A list of sites with anonymous ("Anyone") sharing enabled - Identification of orphaned sites (no active owner) and sites with excessive external guests - Remediation actions for each high-risk site ## Risks and considerations ### Before you start - **Permissions matter:** To enumerate site-level permissions through Graph, the calling app needs `Sites.FullControl.All`. Lower scopes such as `Sites.Read.All` return 403 on `/sites/{id}/permissions`. Plan the consent step with your security lead. - **Do not remediate blindly:** "Everyone except external users" is sometimes intentional (company-wide intranet, all-hands announcements). Review each finding with the site owner before removing access. - **Throttling:** Large tenants can hit Graph throttling. Use `$select`, paginate, and add backoff retries. - **Audit log:** Anything touching permissions is logged. Coordinate with your SOC so your review activity is not flagged as an attack. - **OneDrive is out of scope:** This workflow skips personal sites (`/personal/`). Audit those separately, because the permission model and remediation flow differ. - **Do not change sharing settings during the audit.** Collect findings first, then remediate in a controlled change window. ## Required permissions | Permission | Why it's needed | | --- | --- | | Sites.FullControl.All | Required to read site-level permissions and sharing capability for every SharePoint site. Lower scopes return 403 on the permissions endpoint. | | Sites.Read.All | Minimum scope to enumerate sites and read site metadata. Sufficient for the inventory step but not for permission drill-down. | | Directory.Read.All | Resolve group and user identities referenced in site permissions (for example, to identify "Everyone except external users"). | | SharePoint Administrator role | Required in the SharePoint admin center to view and modify tenant-wide external sharing settings and per-site sharing capability. | ## Ask Dex Paste the prompt into a Dex conversation. ### Prompt for IT admins ``` Audit every SharePoint site in the tenant for security issues and oversharing. Flag sites with 'Everyone' or 'Everyone except external users' in their membership, any site with anonymous (Anyone) sharing enabled, orphaned sites with no owner, and sites with unusually high external guest counts. Produce a CSV report sorted by severity with recommended remediation for each finding. ``` ## Manual steps (admin center) ### Step 1: Open the SharePoint admin center Go to **Microsoft 365 admin center** > **Admin centers** > **SharePoint**, or open `https://{tenant}-admin.sharepoint.com` directly. ### Step 2: Review tenant-wide sharing settings Go to **SharePoint admin center** > **Policies** > **Sharing**. - Confirm the external sharing slider is set to the most restrictive level your business allows. Disable **Anyone** (anonymous links) unless there is a specific business case. - Review the default link type. Prefer *Specific people* over *Anyone* or *People in your organization*. - Set link expiration for Anyone links if they are enabled. ### Step 3: Inventory all active sites Go to **SharePoint admin center** > **Sites** > **Active sites**. - Add the columns *Sharing*, *Primary admin*, *Sensitivity*, and *Last activity (days)* with the column picker. - Click **Export** to download a CSV. This is your starting inventory. ### Step 4: Identify oversharing - Sort the exported CSV by *Sharing* and flag any site set to **Anyone** or **New and existing guests** that should not be. - Filter for sites with no *Primary admin*. These are orphaned and need a new owner assigned. ### Step 5: Drill into high-risk sites For each flagged site, click the site in the admin center and review: - **Membership** tab: site owners, members, and visitors. Remove *Everyone except external users* from the Owners and Members groups unless it is intentional. - **Policies** tab: per-site external sharing. Set it to *Only people in your organization* for sensitive sites (Finance, HR, Legal, Security). - **Sensitivity label:** apply a label (for example, *Confidential*) to enforce inherited protections. ### Step 6: Check active sharing links Within the site (not the admin center), go to **Settings** > **Site permissions** > **Advanced permissions settings** > **Access requests and invitations**. Review and revoke stale guest invitations and anonymous links. ### Step 7: Document and track remediation For every finding, record the site URL, the finding, the owner contacted, the remediation action, and a target date. Revisit later to confirm closure. ## Microsoft Graph API All calls use the base URL `https://graph.microsoft.com/v1.0` and a bearer token with `Sites.FullControl.All`. ### 1. Enumerate all sites ``` GET /sites?search=*&$select=id,displayName,webUrl,createdDateTime ``` Use the `search=*` wildcard to return every site the app can see. Page through `@odata.nextLink` until exhausted. Skip any `webUrl` containing `/personal/` to exclude OneDrive. ### 2. Read site-level permissions ``` GET /sites/{site-id}/permissions ``` Returns the permissions granted on the site (typically app-only grants and sharing links). Example response fragment: ``` {  "value": [    {      "id": "aTowIy5mfG1lbWJlcnNoaXB8...",      "roles": ["read"],      "grantedToIdentitiesV2": [        { "user": { "displayName": "Everyone except external users" } }      ]    }  ] } ``` ### 3. Check sharing capability per site Graph does not expose per-site sharing capability directly. Use the SharePoint REST API: ``` GET https://{tenant}.sharepoint.com/sites/{site}/_api/site/SharingCapability ``` Values: `0` = Disabled, `1` = ExternalUserSharingOnly, `2` = ExternalUserAndGuestSharing (Anyone links), `3` = ExistingExternalUserSharingOnly. ### 4. List site owners (from the backing group) ``` GET /groups/{group-id}/owners ``` For group-connected sites (most modern sites), owners live on the Microsoft 365 group. An empty owner list means the site is orphaned. ### 5. Enumerate guest users with access ``` GET /sites/{site-id}/drive/root/permissions ``` Or walk items recursively for item-level sharing links. For a tenant-wide guest inventory, combine this with `/users?$filter=userType eq 'Guest'`. ### Handling 403 responses If you receive `403 accessDenied` on `/sites/{id}/permissions`, the app is missing `Sites.FullControl.All`. Grant admin consent in the Microsoft Entra admin center under **App registrations** > your app > **API permissions**. ## PowerShell Combine **Microsoft.Graph** (for inventory and cross-tenant data) with **PnP.PowerShell** (for per-site permission drill-down). ### Prerequisites ``` Install-Module Microsoft.Graph -Scope CurrentUser Install-Module PnP.PowerShell -Scope CurrentUser ``` ### Connect ``` Connect-MgGraph -Scopes "Sites.FullControl.All","Directory.Read.All" Connect-PnPOnline -Url "https://{tenant}-admin.sharepoint.com" -Interactive ``` ### Approach 1. **Enumerate sites:** `Get-PnPTenantSite` returns every site with sharing capability, owner, and storage usage in one call. 2. **Loop each site:** record the URL, owner, sharing capability, template, last modified date, and storage used. 3. **Flag oversharing:** flag sites where `SharingCapability` is *ExternalUserAndGuestSharing* (Anyone links), or where the Members group contains `c:0(.s|true` (Everyone except external users). 4. **Check owners:** sites with an empty `Owner` are orphaned. 5. **Export CSV:** one row per site, one column per finding. Run it as a SharePoint Administrator.