Block access example policy
For organizations with a conservative cloud migration approach, the block all policy is an option that can be used.
Caution
Misconfiguration of a block policy can lead to organizations being locked out.
Policies like these can have unintended side effects. Proper testing and validation are vital before enabling. Administrators should utilize tools when making changes.
User exclusions
Conditional Access policies are powerful tools, we recommend excluding the following accounts from your policies:
- Emergency access or break-glass accounts to prevent lockout due to policy misconfiguration. In the unlikely scenario all administrators are locked out, your emergency-access administrative account can be used to log in and take steps to recover access.
- More information can be found in the article, Manage emergency access accounts in Microsoft Entra ID.
- Service accounts and Service principals, such as the Microsoft Entra Connect Sync Account. Service accounts are non-interactive accounts that aren't tied to any particular user. They're normally used by back-end services allowing programmatic access to applications, but are also used to sign in to systems for administrative purposes. Calls made by service principals won't be blocked by Conditional Access policies scoped to users. Use Conditional Access for workload identities to define policies targeting service principals.
- If your organization has these accounts in use in scripts or code, consider replacing them with managed identities.
Create a Conditional Access policy
The following steps help create Conditional Access policies to block access to all apps except for Office 365 if users aren't on a trusted network. These policies are put in to Report-only mode to start so administrators can determine the impact on existing users. When administrators are comfortable that the policies apply as they intend, they can switch them to On.
The first policy blocks access to all apps except for Microsoft 365 applications if not on a trusted location.
- Sign in to the Azure portal as a Conditional Access Administrator, Security Administrator, or Global Administrator.
- Browse to Microsoft Entra ID > Security > Conditional Access.
- Select Create New policy.
- Give your policy a name. We recommend that organizations create a meaningful standard for the names of their policies.
- Under Assignments, select Users or workload identities.
- Under Include, select All users.
- Under Exclude, select Users and groups and choose your organization's emergency access or break-glass accounts.
- Under Target resources > Cloud apps, select the following options:
- Under Include, select All cloud apps.
- Under Exclude, select Office 365, select Select.
- Under Conditions:
- Under Conditions > Location.
- Set Configure to Yes
- Under Include, select Any location.
- Under Exclude, select All trusted locations.
- Under Client apps, set Configure to Yes, and select Done.
- Under Conditions > Location.
- Under Access controls > Grant, select Block access, then select Select.
- Confirm your settings and set Enable policy to Report-only.
- Select Create to create to enable your policy.
After administrators confirm the settings using report-only mode, they can move the Enable policy toggle from Report-only to On.
The following policy is created to require multifactor authentication or a compliant device for users of Microsoft 365.
- Select Create new policy.
- Give your policy a name. We recommend that organizations create a meaningful standard for the names of their policies.
- Under Assignments, select Users or workload identities.
- Under Include, select All users.
- Under Exclude, select Users and groups and choose your organization's emergency access or break-glass accounts.
- Under Target resources > Cloud apps > Include > Select apps, choose Office 365, and select Select.
- Under Access controls > Grant, select Grant access.
- Select Require multifactor authentication and Require device to be marked as compliant select Select.
- Ensure Require one of the selected controls is selected.
- Select Select.
- Confirm your settings and set Enable policy to Report-only.
- Select Create to create to enable your policy.
After administrators confirm the settings using report-only mode, they can move the Enable policy toggle from Report-only to On.
Note
Conditional Access policies are enforced after first-factor authentication is completed. Conditional Access isn't intended to be an organization's first line of defense for scenarios like denial-of-service (DoS) attacks, but it can use signals from these events to determine access.