Conditional access policy for SharePoint sites and OneDrive
Some features in this article require Microsoft Syntex - SharePoint Advanced Management
With Azure Active Directory authentication context, you can enforce more stringent access conditions when users access SharePoint sites.
You can use authentication contexts to connect an Azure AD conditional access policy to a SharePoint site. Policies can be applied directly to the site or via a sensitivity label.
Note that this capability can't be applied to the root site in SharePoint (for example, https://contoso.sharepoint.com).
Requirements
Using authentication context with SharePoint sites requires one of the following licenses:
- Microsoft Syntex - SharePoint Advanced Management
- Microsoft 365 E5/A5/G5
- Microsoft 365 E5/A5/G5/F5 Compliance
- Microsoft 365 E5/F5 Information Protection and Governance
- Office 365 E5/A5/G5
Limitations
Some apps don't work with authentication contexts. We recommend testing apps on a site with authentication context enabled before broadly deploying this feature.
The following apps and scenarios don't work with authentication contexts:
- Older version of Office apps (see the list of supported versions)
- Yammer
- Teams web app
- OneNote app can't be added to channel if the associated SharePoint site has an authentication context
- Teams private channel won't provision a SharePoint site if the main team site has an authentication context
- Teams channel meeting recording upload fails on sites with an authentication context
- SharePoint folder renaming in Teams fails if the site has an authentication context
- Teams webinar scheduling fails if OneDrive has an authentication context
- Workflows that use Power Apps or Power Automate fails to work for sites with an authentication context
- Third-party apps
- The OneDrive sync app won't sync sites with an authentication context
- Copy or move files from a site with no authentication context to a site with an authentication context fails
- Associating an authentication context to the enterprise application catalog site collection is not supported
Setting up an authentication context
Setting up an authentication context for labeled sites requires these basic steps:
Add an authentication context in Azure Active Directory.
Create a conditional access policy that applies to that authentication context and has the conditions and access controls that you want to use.
Do one of the following:
- Set a sensitivity label to apply the authentication context to labeled sites.
- Apply the authentication context directly to a site
In this article, we'll look at the example of requiring guests to agree to a terms of use before gaining access to a sensitive SharePoint site. You can also use any of the other conditional access conditions and access controls that you might need for your organization.
Add an authentication context
First, add an authentication context in Azure Active Directory.
To add an authentication context
In Azure Active Directory Conditional Access, under Manage, click Authentication context.
Click New authentication context.
Type a name and description and select the Publish to apps check box.
Click Save.
Create a conditional access policy
Next, create a conditional access policy that applies to that authentication context and that requires guests to agree to terms of use as a condition of access.
To create a conditional access policy
In Azure Active Directory Conditional Access, click New policy.
Type a name for the policy.
On the Users and groups tab, choose the Select users and groups option, and then select the Guest or external users check box.
Choose B2B collaboration guest users from the dropdown.
On the Cloud apps or actions tab, under Select what this policy applies to, choose Authentication context, and select the check box for the authentication context that you created.
On the Grant tab, select the check box for the terms of use that you want to use, and then click Select.
Choose if you want to enable the policy, and then click Create.
Apply the authentication context directly to a site
You can directly apply an authentication context to a SharePoint site by using the Set-SPOSite PowerShell cmdlet.
Note
This capability requires a Microsoft 365 E5 or Microsoft Syntex - SharePoint Advanced Management license.
In the following example, we apply the authentication context we created above to a site called "research."
Set-SPOSite -Identity https://contoso.sharepoint.com/sites/research -ConditionalAccessPolicy AuthenticationContext -AuthenticationContextName "Sensitive information - guest terms of use"
Set a sensitivity label to apply the authentication context to labeled sites
If you want to use a sensitivity label to apply the authentication context, update a sensitivity label (or create a new one) to use the authentication context.
Note
Sensitivity labels require Microsoft 365 E5 or Microsoft 365 E3 plus the Advanced Compliance license.
To update a sensitivity label
In the Microsoft Purview compliance portal, on the Information protection tab, click the label that you want to update and then click Edit label.
Click Next until you are on the Define protection settings for groups and sites page.
Ensure that the External sharing and Conditional Access settings check box is selected, and then click Next.
On the Define external sharing and device access settings page, select the Use Azure AD Conditional Access to protect labeled SharePoint sites check box.
Select the Choose an existing authentication context option.
In the dropdown list, choose the authentication context that you want to use.
Click Next until you are on the Review your settings and finish page, and then click Save label.
Once the label has been updated, guests accessing a SharePoint site (or the Files tab in a team) with that label will be required to agree to the terms of use before gaining access to that site.
See also
Conditional Access: Cloud apps, actions, and authentication context
Feedback
Submit and view feedback for