Close Menu
Peter Klapwijk – In The Cloud 24-7Peter Klapwijk – In The Cloud 24-7
    Facebook X (Twitter) Instagram
    Peter Klapwijk – In The Cloud 24-7Peter Klapwijk – In The Cloud 24-7
    • Home
    • Intune
    • Windows
      • Modern Workplace
    • macOS
    • Android
    • iOS
    • Automation
      • Logic Apps
      • Intune Monitoring
      • GitHub
    • Security
      • Passwordless
      • Security
    • Speaking
    • About me
    Peter Klapwijk – In The Cloud 24-7Peter Klapwijk – In The Cloud 24-7
    Home»Exchange Online»Restrict access to email attachments and SharePoint files with Conditional Access
    Exchange Online

    Restrict access to email attachments and SharePoint files with Conditional Access

    Peter KlapwijkBy Peter KlapwijkJanuary 20, 2019Updated:December 21, 202065 Mins Read

    Today a blog post about Azure AD Conditional Access (CA) policies in combination with Exchange and SharePoint Online. I will show in this post how to restrict access to Exchange Online and SharePoint Online in the browser on unmanaged devices. Using these policies we prevent our users to download email attachments or SharePoint files on unmanaged devices.

    Configuration for Exchange Online

    For Exchange Online Outlook on the Web (OWA) we can restrict the option to download email attachments to the local device or even prevent the user from viewing the attachment in the browser.
    To create a restricted user experience in OWA we need to use the Exchange PowerShell command Set-OwaMailboxPolicy to change the OWA mailbox policy. We need to change the parameter ConditionalAccessPolicy which is set to Off by default. The three options we have for this parameter are:

    • Off: No conditional access policy is applied to Outlook on the web. This is the default value.
    • ReadOnly: Users can’t download attachments to their local computer, and can’t enable Offline Mode on non-compliant computers. They can still view attachments in the browser.
    • ReadOnlyPlusAttachmentsBlocked: All restrictions from ReadOnly apply, but users can’t view attachments in the browser.

    Connect to Exchange Online using the Microsoft Exchange Online PowerShell Module.
    When we run Get-OwaMailboxPolicy we can see the parameter ConditionalAcessPolicy is set to off.

    When we use this PowerShell command we set the paramater to ReadOnly:
    Get-OwaMailboxPolicy | Set-OwaMailboxPolicy -ConditionalAccessPolicy ReadOnly

    Now we need to switch to the Azure Portal and create an Azure AD Conditional Access policy to enforce this setting on unmanaged devices.
    Create a new policy and give it a name.
    Under Assignments we need to choose a security group to assign the policy to or choose All Users.
    Under Cloud apps we need choose Office 365 Exchange Online.

    Under Conditions, Device platforms we select All platforms.

    On the Client apps tab we only select Browser.

    On the Device state tab we select Device marked as compliant.

    Now we move to the Access Control section, on the Session tab we select Use app enforced restrictions.
    On the left side, we set Enable policy to On and we click on Create.

    Keep in mind it can take some time before these settings are active in Exchange Online.

    End-user experience

    Let`s have a look at how the end-user experience is on an unmanaged device.
    When we logon to Outlook on the web and open an email with an attachment, we are presented with a notification. The notification informs us about the restricted access to attachments until we change settings required by our organization.
    When we select the attachment itself, we see the attachment can only be saved to OneDrive (not locally) or it can be viewed.

    If we had set the parameter ConditionalAccessPolicy of the OWA Mailbox Policy to ReadOnlyPlusAttachmentsBlocked we couldn`t even view the attachment in the browser.

    Configuration for SharePoint Online

    For SharePoint Online (and OneDrive for Business) we can create a similar restricted user experience on unmanaged devices like we can with Exchange Online. With SharePoint Online we restrict access on unmanaged devices to the browser like we do with Exchange Online, but with Conditional Access policies we also prevent the synchronization of SharePoint files to the device.
    This configuration is done from the SharePoint Admin Center. Open the admin center and browse to the Access control tab. Under Unmanaged Devices we need to select Allow limited, web-only access. This allows the user to access the SharePoint data from an unmanaged device, but prevents downloading and synchronizing the data to the local device.
    When we set this option to limited access, we also block apps that don`t use modern authentication as you can see in the notification.

    On the background two Conditional Access policies are created to enforce the restrictions. In this previous blog I discussed the settings of those policies in more detail.
    Keep in mind it can take some time before these settings are active in SharePoint Online.

    End-user experience

    Let`s have a look again how the end-user experience is on an unmanaged device.
    Open a SharePoint or OneDrive site in the browser. The first thing you probably see is the notification with information about the restrictions which are active. The options to download a file or sync the site are removed. But we are allowed to open the files in Office Online and also edit the files online.

    This user experience is not limited to SharePoint Online and OneDrive for Business, but is also extended to Microsoft Teams as the Teams files are located in a SharePoint library. When we try to download a file from Teams we see an error like below.

    Licenses

    Azure AD Conditional Access policies are an Azure AD Premium feature. Users who are in scope of one of these CA polices need to have assigned an Azure AD Premium license. This license can be purchased as standalone license or as part of an Microsoft 365 or Enterprise Mobility + Security (EMS) license.
    Microsoft Intune, which is used to manage the devices, can be purchased as standalone license or as part of EMS or Microsoft 365.

    Azure AD Conditional Access EMS Exchange Online Microsoft 365 OneDrive for Business Security SharePoint Online Teams Windows 10
    Share. Facebook Twitter LinkedIn Email WhatsApp
    Peter Klapwijk
    • Website
    • X (Twitter)
    • LinkedIn

    Peter is a Security (Intune) MVP since 2020 and is working as Modern Workplace Engineer at Wortell in The Netherlands. He has more than 15 years of experience in IT, with a strong focus on Microsoft technologies like Microsoft Intune, Windows, and (low-code) automation.

    Related Posts

    Intune – Enrollment Status Page

    May 18, 2018

    Azure AD Pass-Through Authentication and Seamless Single Sign-on

    December 12, 2016

    Azure Active Directory Domain Services

    September 26, 2016
    View 6 Comments

    6 Comments

    1. andy fulleton on April 7, 2020 09:14

      Hi would this also stop the ability of the user to attach a file from One Drive from web access? I am thinking to attach a file via a browser, you would first have to download it temporarily to the device?

      Reply
      • Peter Klapwijk on April 13, 2020 08:33

        For OneDrive the same conditions are in place as for SharePoint.

        Regards,

        Peter

        Reply
    2. Guennouni on April 29, 2020 13:38

      Hello Peter,

      I have some issues with those options. I don’t get the same result and I am getting a lot of question about this issue. Our customers want to make everything possible on a corporate owned device (download,offline sync etc) and either block or limit access on non corporate devices. I can’t manage to get this to work the right way even in cooperation with Microsoft (we are a premium partner).
      Could I come in contact with you on this matter (maybe on a consult base)?

      Reply
    3. Zubair on October 19, 2020 10:36

      Thank you so much for your so nice explanations. I did the same as you defined, hopefully it will get my goals.
      Again thank you so much you helped me a lot.

      Reply
    4. Ronald on November 3, 2020 20:59

      how long does it take when i set Get-OwaMailboxPolicy | Set-OwaMailboxPolicy -ConditionalAccessPolicy ReadOnly

      Reply
    5. DK on November 22, 2021 17:25

      If we have Outlook application (ActiveSync proto) on the remote user’s PCs, user can save any attachment without control.

      Reply
    Leave A Reply Cancel Reply

    Peter Klapwijk

    Hi! Welcome to my blog post.
    I hope you enjoy reading my articles.

    Hit the About Me button to get in contact with me or leave a comment.

    Awards
    Sponsor
    Latest Posts

    Hide the “Turn on an ad privacy feature” pop-up in Chrome with Microsoft Intune

    April 19, 2025

    How to set Google as default search provider with Microsoft Intune

    April 18, 2025

    Using Windows Autopilot device preparation with Windows 365 Frontline shared cloud PCs

    April 13, 2025

    Using Visual Studio with Microsoft Endpoint Privilege Management, some notes

    April 8, 2025
    follow me
    • Twitter 4.8K
    • LinkedIn 6.1K
    • YouTube
    Tags
    Administrative Templates Android Automation Autopilot Azure Azure AD Browser Conditional Access Edge EMS Exchange Online Feitian FIDO2 Flow Google Chrome Graph Graph API Identity Management Intune Intune Monitoring iOS KIOSK Logic Apps macOS MEM MEMMonitoring Microsoft 365 Microsoft Edge Microsoft Endpoint Manager Modern Workplace Office 365 OneDrive for Business Outlook Passwordless PowerApps Power Automate Security SharePoint Online Teams Windows Windows 10 Windows10 Windows 11 Windows Autopilot Windows Update
    Copy right

    This information is provided “AS IS” with no warranties, confers no rights and is not supported by the authors, or In The Cloud 24-7.

     

    Copyright © 2025 by In The Cloud 24-7/ Peter Klapwijk. All rights reserved, No part of the information on this web site may be reproduced or posted in any form or by any means without the prior written permission of the publisher.

    Shorthand; Don’t pass off my work as yours, it’s not nice.

    Recent Comments
    • Peter Klapwijk on Using Windows Autopilot device preparation with Windows 365 Frontline shared cloud PCs
    • John M on Using Windows Autopilot device preparation with Windows 365 Frontline shared cloud PCs
    • Christoffer Jakobsen on Connect to Azure file shares with Microsoft Entra Private Access
    • Ludo on How to block Bluetooth file transfer with Microsoft Intune
    • RCharles on Automatically configure the time zone (during Autopilot enrollment)
    most popular

    Application installation issues; Download pending

    October 1, 2024

    Restrict which users can logon into a Windows 10 device with Microsoft Intune

    April 11, 2020

    How to change the Windows 11 language with Intune

    November 11, 2022

    Update Microsoft Edge during Windows Autopilot enrollments

    July 9, 2024
    Peter Klapwijk – In The Cloud 24-7
    X (Twitter) LinkedIn YouTube RSS
    © 2025 ThemeSphere. Designed by ThemeSphere.

    Type above and press Enter to search. Press Esc to cancel.

    Manage Cookie Consent
    To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
    Functional Always active
    The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
    Preferences
    The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
    Statistics
    The technical storage or access that is used exclusively for statistical purposes. The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
    Marketing
    The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
    Manage options Manage services Manage {vendor_count} vendors Read more about these purposes
    View preferences
    {title} {title} {title}