How to make SharePoint guest access expire automatically

Make guest access expire within 30 days.

Every Microsoft 365 security check · Collaboration & Sharing · NL-SPO-107

What this check looks at

Checks that a guest’s access to a site or OneDrive ends on its own within 30 days unless someone renews it.

ExternalUserExpirationRequired and ExternalUserExpireInDays decide whether a guest’s access to a site or OneDrive ends on its own after a number of days, unless a site owner renews it. Microsoft ships it off.

The check reads the setting from the SharePoint admin API as ConfigCheckup Automation, only where the client granted it Sites.FullControl.All, and only ever reads it. It passes when sharing outside is off, or guest access expires within 30 days, and fails when it never expires or only after longer.

Why it matters

Guests are invited for a piece of work and then forgotten. Access that ends on its own closes the door for partners and contractors the business no longer works with, without anyone having to remember.

Guests are invited for a piece of work and then forgotten. Access that ends on its own closes the door on contractors and partners the business no longer works with, without anyone having to remember to do it.

CIS Microsoft 365 Foundations Benchmark 7.2.9 asks for guest access to expire within 30 days. Site owners are emailed before it ends and can renew a guest who still needs it.

How to fix it

Where: SharePoint admin centre → Policies → Sharing

Before you start

  • Site owners get an email before a guest’s access ends and can renew it: tell them so before turning it on.
  • Tell users what is changing and when, with a contact for problems.

Step by step

  1. Tell people what changes. Tell staff, and site owners who share a lot with partners, that guests’ access will end after the number of days set unless they renew it, and that they are emailed first, the date it changes and who to ask about it.
  2. Turn on guest expiry. In the SharePoint admin centre (https://<tenant>-admin.sharepoint.com), go to Policies > Sharing > More external sharing settings, tick "Guest access to a site or OneDrive will expire automatically after this many days" and enter 30 or fewer. Select Save.
  3. Or set it with PowerShell. Connect-SPOService -Url https://<tenant>-admin.sharepoint.com, then Set-SPOTenant -ExternalUserExpirationRequired $true -ExternalUserExpireInDays 30.
  4. Check it took effect. Get-SPOTenant | Select-Object ExternalUserExpirationRequired, ExternalUserExpireInDays shows True and 30 or fewer, and the next assessment passes.

With PowerShell

Connect-SPOService -Url https://<tenant>-admin.sharepoint.com
Set-SPOTenant -ExternalUserExpirationRequired $true -ExternalUserExpireInDays 30

What users will notice

A guest’s access to a site or OneDrive ends after the number of days set unless a site owner renews it.

How to confirm it worked

Get-SPOTenant | Select-Object ExternalUserExpirationRequired, ExternalUserExpireInDays shows True and 30 or fewer.

Frameworks and controls

This check maps to controls in 13 frameworks. Passing it is evidence that the setting is in place, not a certification against any of them.

The frameworks and controls NL-SPO-107 maps to
FrameworkControl
NCSC CAFB2.c Privileged user management
DSPTStandard 4: Managing data access
DORAArt. 9(4)(c) Limiting logical access to what is required
NIS2Art. 21(2)(i) Access control and asset management
Zero TrustIdentitiesData
SOC 2CC6.2 User registration, authorisation and removalCC6.3 Role-based access and least privilege
NIST SP 800-1713.1.1 Limit system access to authorised users, processes and devices
CMMC Level 2AC.L2-3.1.1 Authorized Access Control
ISO 27001:2022A.5.18 Access rightsA.5.19 Information security in supplier relationships
CIS M3657.2.9 Ensure guest access to a site or OneDrive will expire automatically
CIS Controls v8.16.1 Establish an access granting process (IG1)
NIST CSF 2.0PR.AA-05: Access permissions, entitlements, and authorizations are defined in a policy, managed, enforced, and reviewed, and incorporate the principles of least privilege and separation of duties
NCSC 10 StepsIdentity and access managementData security

The framework mappings were last checked against the published standards in October 2026.

Microsoft’s documentation

The full Microsoft 365 security checklist, worst first

ConfigCheckup

Check this in every tenant.

ConfigCheckup runs this check on every tenant you connect and gives you a step-by-step fix guide. The next assessment confirms the fix.

14 days of daily monitoring and alerts, every finding with its fix guide, and reports on up to 3 tenants, from your first connected tenant. No card. Then choose the plan that fits.Where this check fits: Microsoft 365 security assessment for MSPs