Skip to content

Ulysses Neves

Microsoft Entra ID, authentication, and hybrid identity troubleshooting.

Menu
  • Home
  • Microsoft Azure
  • Microsoft AD FS
  • Microsoft 365
  • Contact
  • Troubleshooting Index
Menu

Microsoft Entra ID – How to limit access to Outlook Web Access data using a CA policy

Posted on June 22, 2020

Hello everyone. Today I’ll present a step-by-step guide on how to integrate Conditional Access policies with Exchange Online policies to limit access to OWA. With the rise of mobility and the growing concern organizations have about protecting information stored on mobile devices, administrators face the difficult task of protecting the information that users can access.

In today’s article, I’ll show how to block the download and editing of files attached to emails based on the user’s location. We will perform the following tasks:

  • Integrate the OWA access policy in Exchange Online with the Conditional Access policy in Microsoft Entra ID.
  • Create a country-based location.
  • Create a Conditional Access policy to block the download and editing of files outside the location configured in the previous step.

Integrating the OWA policy with the Conditional Access policy

To integrate the OWA access policy with the Conditional Access policy, the first step is to connect to EXO using PowerShell.

Let’s open PowerShell in administrator mode and run the command below to install the Exchange Online module:

Install-Module -Name ExchangeOnlineManagement

As shown on the screen below, confirm the installation by selecting the All option.

With the module installed, let’s connect to the EXO service. Run the command below to capture the credential for administrative access to the Exchange Online service:

$UserCredential = Get-Credential

Now let’s run the command below to create a session in the Exchange Online service using the credential stored in the previous step:

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection

You should see the screen below after running the command.

Now let’s run the commands below to allow scripts to run remotely:

Set-ExecutionPolicy RemoteSigned
Import-PSSession $Session -DisableNameChecking

Let’s test the connection by running the command below to retrieve the mailboxes available in the EXO service:

Get-Mailbox *

For more information about connecting to EXO using PowerShell, take a look at this document available on the Microsoft website.

Integrating the OWA access policy in Exchange Online

Connected to EXO, run the command below to integrate the Exchange Online OWA access policy with the Conditional Access policy as read-only. This will enable the “Read Only” rule in OWA for access that matches the Conditional Access policy that we will define later.

Set-OwaMailboxPolicy -Identity OwaMailboxPolicy-Default -ConditionalAccessPolicy ReadOnly

Creating a trusted location in Microsoft Entra ID

With the integration in EXO created, let’s now create a location considered trusted to define the exception in the Conditional Access policy.

For our illustration, let’s create a country-based location. To do that, go to the Named locations menu.

Let’s click New location to create a location based on countries/regions.

Creating the Conditional Access policy

With the named location created, let’s create the Conditional Access policy by going to the Conditional Access | Policies menu.

Let’s create a new policy by clicking New policy.

Let’s define a name for the Conditional Access policy we are creating.

In the steps below, we’ll define which users will be affected by the policy:
1 – Select the Users and groups option.
2 – Select the Select users and groups option. I’ll select only one user for our illustration.
3 – Check the Users and groups option.
4 – Select the users to whom you want to apply the policy.

Now let’s define which application will be affected by the policy. We’ll define the Office 365 Exchange Online application as the application to be controlled by performing the steps below:
1 – Select the Cloud apps or actions menu.
2 – Select the Select apps option.
3 – Select the Office 365 Exchange Online application.

Click Done.

Now let’s define the location to be controlled by the policy by following the steps below:
1 – Select the Conditions > Locations menu.
2 – Enable the setting by selecting YES.
3 – Select the Any location option.

Now let’s exclude the location that we do not want to block by performing the steps below:
1 – Select the Exclude option.
2 – Select the Selected locations option.
3 – Select the locations for which you want to allow full access to OWA.

Now let’s configure the control to be applied for the criteria above. In the Access controls menu, click Session.

Select the Use app enforced restrictions control.

Let’s enable the policy we just configured by selecting ON in the Enable policy menu and clicking Create.

Testing the policy

To test whether the policy is working, I sent an email with an attached Excel file to the user otto@ulyneves.com configured in the policy.

OWA access test from Brazil

Let’s now access the email of user otto@ulyneves.com from Brazil, which the Conditional Access policy considers a trusted location for downloading or editing attached files.

We observe that access is normal and it is possible to download or edit the attached file as usual.

When evaluating the access in the Microsoft Entra ID logs, we observe on the Basic info tab that the user otto@ulyneves.com successfully accessed the Office 365 Exchange Online service.

On the Location tab, we can observe that the access originated from Brazil, which the policy considers an exception to the access control.

As a result, the Conditional Access policy is not applied, as indicated by the Result column.

Access from outside Brazil

Now let’s test OWA access from a location controlled by the Conditional Access policy.

Let’s access OWA from a device located in Amsterdam.

When opening the same email, we observe the message: Your organization doesn’t allow you to download or print attachments from this device or browser. You can still view attachments in your browser. For more information, contact your IT administrator.

When clicking the attached document, we observe the same message.

When evaluating the access above in the Microsoft Entra ID sign-in logs, we observe on the Basic info tab that access to the Office 365 Exchange Online service is successful, just as in the previous test.

We confirm through the Location tab that the access originated from Amsterdam, which is a location affected by the policy we configured.

On the Conditional Access tab, we can observe that the Conditional Access policy has a Success result, meaning that all criteria were satisfied to apply the read-only access policy to the data through OWA.

Summary

In today’s article, we demonstrated how to limit user access through OWA by using Conditional Access policies integrated with OWA policies in Exchange Online.

I hope this content has helped broaden your knowledge of Microsoft Entra ID.

Did you like the post? Like and share. 🙂

If you have any suggestions or observations, leave a comment.

Regards,

Ulysses Neves

Related guides: Browse the Microsoft Identity Troubleshooting Index or the Microsoft AD FS topic archive.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • Microsoft Defender for Identity domain investigation: six questions to ask first September 10, 2026
  • Microsoft Entra Kerberos key rotation: what changes—and what administrators should check September 6, 2026
  • Microsoft Authenticator Will Block Jailbroken Devices in 2026 — What You Need to Know March 17, 2026
  • Enhancing Azure role activation security with FIDO2/Passkeys September 23, 2024
  • Microsoft Entra ID CAP | Enforcing WHfB using Authentication Strength April 21, 2024

Archives

  • September 2026
  • March 2026
  • September 2024
  • April 2024
  • February 2024
  • December 2023
  • September 2023
  • July 2023
  • June 2023
  • May 2023
  • April 2023
  • March 2023
  • February 2023
  • January 2023
  • December 2022
  • October 2022
  • September 2022
  • August 2022
  • July 2022
  • June 2022
  • May 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020
  • June 2020
  • May 2020
  • April 2020
  • March 2020
  • February 2020
  • January 2020
  • December 2019
  • November 2019
  • October 2019
  • September 2019
  • August 2019
  • July 2019

Tags

#aaddownleveldevice #adfs #adfscertificate #adfscertificates #adfsmfaadapter #azureauth #azureCA #azuredevice #capolicy #cloudsummit2021 #conditionalaccess #conditionalaccesspolicy #deviceregistration #farmbehavior #gopasswordless #mfaserver #msidentity #namedlocation #securingazure #securingazuread #sslprivatekey #troubleshootingadfs #troubleshootingwaptrust #tshootadfs #waptrust #webapplicationproxy #WHFBcerttrust #whfbdeployment #WHfBhybridsetup #WHfBprovisioning #widdatabase adconnect AD FS authenticationstrength az500 azurepim Azure security cloudsecurity microsoft365 Microsoft Azure Microsoft Entra hybrid join Microsoft Entra ID Microsoft Entra MFA PowerShell WHfB
©2026 Ulysses Neves | Design: Newspaperly WordPress Theme
Ulysses Neves
Gerenciar Consentimento de Cookies
Para fornecer as melhores experiências, usamos tecnologias como cookies para armazenar e/ou acessar informações do dispositivo. O consentimento para essas tecnologias nos permitirá processar dados como comportamento de navegação ou IDs exclusivos neste site. Não consentir ou retirar o consentimento pode afetar negativamente certos recursos e funções.
Funcional Always active
O armazenamento ou acesso técnico é estritamente necessário para a finalidade legítima de permitir a utilização de um serviço específico explicitamente solicitado pelo assinante ou utilizador, ou com a finalidade exclusiva de efetuar a transmissão de uma comunicação através de uma rede de comunicações eletrónicas.
Preferências
O armazenamento ou acesso técnico é necessário para o propósito legítimo de armazenar preferências que não são solicitadas pelo assinante ou usuário.
Estatísticas
O armazenamento ou acesso técnico que é usado exclusivamente para fins estatísticos. O armazenamento técnico ou acesso que é usado exclusivamente para fins estatísticos anônimos. Sem uma intimação, conformidade voluntária por parte de seu provedor de serviços de Internet ou registros adicionais de terceiros, as informações armazenadas ou recuperadas apenas para esse fim geralmente não podem ser usadas para identificá-lo.
Marketing
O armazenamento ou acesso técnico é necessário para criar perfis de usuário para enviar publicidade ou para rastrear o usuário em um site ou em vários sites para fins de marketing semelhantes.
  • Manage options
  • Manage services
  • Manage {vendor_count} vendors
  • Read more about these purposes
Ver preferências
  • {title}
  • {title}
  • {title}