Control access from unmanaged devices

Note: Some functionality is introduced gradually to organizations that have set up the Targeted release option. This means that you may not yet see this feature or it may look different than what is described in this article.

As a SharePoint or global admin in Office 365, you can block or limit access to SharePoint and OneDrive content from unmanaged devices (those not joined to a domain or compliant in Intune). You can block or limit access for:

  • All users in the organization or only some users or security groups.

  • All sites in the organization or only some site collections.

Blocking access helps provide security but comes at the cost of usability and productivity. Limiting access allows users to remain productive while addressing the risk of accidental data loss on unmanaged devices. When you limit access, users on managed devices will have full access (unless they use one of the browser and operating system combinations listed below). Users on unmanaged devices will have browser-only access with no ability to download, print, or sync files. They also won't be able to access content through apps, including the Microsoft Office desktop apps. When you limit access, you can choose to allow or block editing files in the browser.

Notes: 

Block access to SharePoint and OneDrive content using the SharePoint admin center

  1. Sign in to Office 365 as a global admin or SharePoint admin.

  2. Select the app launcher icon The icon that looks like a waffle and represents a button click that will reveal multiple application tiles for selection. in the upper-left and choose Admin to open the Office 365 admin center. (If you don't see the Admin tile, you don't have Office 365 administrator permissions in your organization.)

  3. In the left pane, choose Admin centers > SharePoint.

  4. In the SharePoint admin center, click access control.

  5. Select Block Access.

  6. Click OK.

    The block access setting on the access control page

    Note: It can take 5-10 minutes for the policy to take effect. It won't take effect for users who are already signed in from unmanaged devices.

If you go to the Azure AD admin center and click Conditional access, you can see that a policy was created by the SharePoint admin center.

Creating a policy in the Azure AD admin center to block access

Limit access to SharePoint and OneDrive content using the SharePoint admin center

  1. Sign in to Office 365 as a global admin or SharePoint admin.

  2. Select the app launcher icon The icon that looks like a waffle and represents a button click that will reveal multiple application tiles for selection. in the upper-left and choose Admin to open the Office 365 admin center. (If you don't see the Admin tile, you don't have Office 365 administrator permissions in your organization.)

  3. In the left pane, choose Admin centers > SharePoint.

  4. In the SharePoint admin center, click access control.

  5. Select Allow limited, web-only access.

  6. Click OK.

    The limited access setting on the access control page

    Notes: 

    • It can take 5-10 minutes for the policies to take effect. They won't take effect for users who are already signed in from unmanaged devices.

    • By default, this policy allows users to view and edit files in their web browser. To change this, see Advanced configurations.

If you go to the Azure AD admin center and click Conditional access, you can see that two policies were created by the SharePoint admin center. By default, the policy applies to all users. To apply it to only specific security groups, make changes under Users and groups. Be careful not to create multiple conditional access polices in the Azure AD admin center that conflict with each other. You can disable the policies created by the SharePoint admin center and then manually create the conditional access policies you need.

Creating two policies in the Azure AD admin center to limit access

Limit access to SharePoint and OneDrive content using PowerShell

  1. Download the latest SharePoint Online Management Shell.

  2. Connect to SharePoint Online as a global admin or SharePoint admin in Office 365. To learn how, see Getting started with SharePoint Online Management Shell.

  3. Run Set-SPOTenant -ConditionalAccessPolicy AllowLimitedAccess.

Note: By default, this policy allows users to view and edit files in their web browser. To change this, see Advanced configurations.

Block or limit access to specific SharePoint site collections or OneDrive accounts

To block or limit access to specific sites, you must set the organization-wide policy to "Allow full access from desktop apps, mobile apps, and the web." Then follow these steps to manually create a policy in the Azure AD admin center and run PowerShell cmdlets.

  1. In the Azure AD admin center, select Conditional access, and then click Add.

  2. Under Users and groups, select whether you want the policy to apply to all users or only specific security groups.

  3. Under Cloud apps, select Office 365 SharePoint Online.

  4. Under Conditions, select both Mobile apps and desktop clients and Browser.

  5. Under Session, select Use app enforced restrictions. This tells Azure to use the settings you'll specify in SharePoint.

  6. Enable the policy and save it.

    Creating a policy in the Azure AD admin center to use app-enforced restrictions
  7. Download the latest SharePoint Online Management Shell.

  8. Connect to SharePoint Online as a global admin or SharePoint admin in Office 365. To learn how, see Getting started with SharePoint Online Management Shell.

  9. To block access, run Set-SPOSite -Identity https://<SharePoint online URL>/sites/<name of site collection or OneDrive account> -ConditionalAccessPolicy BlockAccess.

    To limit access, run Set-SPOSite -Identity https://<SharePoint online URL>/sites/<name of site collection or OneDrive account> -ConditionalAccessPolicy AllowLimitedAccess.

Notes: 

  • The site collection-level setting must be at least as restrictive as the organization-wide setting.

  • By default, this policy allows users to view and edit files in their web browser. To change this, see Advanced configurations.

Advanced configurations

The following parameters can be used with -ConditionalAccessPolicy AllowLimitedAccess for both the organization-wide setting and the site-level setting:

-AllowEditing $false Prevents users from editing Office files in the browser and copying and pasting Office file contents out of the browser window.

-LimitedAccessFileType -OfficeOnlineFilesOnly Allows users to preview only Office files in the browser. This option increases security but may be a barrier to user productivity.

-LimitedAccessFileType -WebPreviewableFiles (default) Allows users to preview Office files and other file types (such as PDF files and images) in the browser. Note that the contents of file types other than Office files are handled in the browser. This option optimizes for user productivity but offers less security for files that aren't Office files.

-LimitedAccessFileType -OtherFiles Allows users to download files that can't be previewed, such as .zip and .exe. This option offers less security.

The AllowDownlownloadingNonWebViewableFiles parameter has been discontinued. Please use LimitedAccessFileType instead.

External users will be affected when you use conditional access policies to block or limit access from unmanaged devices. If users have shared items with specific people (who must enter a verification code sent to their email address), you can exempt them from this policy by running the following cmdlet.

Set-SPOTenant -ApplyAppEnforcedRestrictionsToAdHocRecipients $false

Note: Anonymous access links (shareable links that don't require sign-in) are not affected by these policies. Anyone who has an anonymous access link to an item will be able to download the item. For all site collections where you enable conditional access policies, you should disable anonymous access links.

App impact

Blocking access and blocking download may impact the user experience in some apps, including some Office apps. We recommend that you turn on your policy for some users and test the experience with the apps used in your organization. In Office, make sure to check the behavior in Flow and PowerApps when your policy is on.

Note: Apps that run in “app-only” mode in the service, like antivirus apps and search crawlers, are exempted from the policy.

See Also

Control access to SharePoint Online and OneDrive data based on defined network locations

Expand your Office skills
Explore training
Get new features first
Join Office Insiders

Was this information helpful?

Thank you for your feedback!

Thank you for your feedback! It sounds like it might be helpful to connect you to one of our Office support agents.

×