Skip to main content

Enforcing MFA with Conditional Access

Learn to configure Conditional Access policies that require MFA based on real risk signals like location, rather than for every single login.

Overview and What You Will Learn

Conditional Access is the policy engine in Microsoft Entra ID (formerly Azure AD) that decides at sign-in whether to allow access, block it, or ask for extra proof such as multi-factor authentication (MFA), based on conditions like user, app, location and risk. In this lab you will turn on Security Defaults for baseline MFA, then replace it with a targeted Conditional Access policy that you test in report-only mode before enforcing.

  • Checking and enabling Security Defaults
  • Creating a break-glass account and a trusted named location
  • Building a Conditional Access policy that requires MFA outside trusted locations
  • Testing in report-only mode and reading the results
  • Enforcing the policy safely with a pilot group
Security

This lab changes tenant-wide sign-in settings. Run it in a test tenant, never in a production tenant where a mistake can lock out real users.

Why This Matters in Production

MFA stops most account takeovers even when an attacker already holds a valid password. Microsoft has published research saying MFA blocks over 99 percent of account compromise attacks. Imagine a trading platform team at a company like Zerodha where a single stolen admin password could reach production systems. Enforced MFA turns that password into one factor of two, and Conditional Access lets you apply it precisely instead of annoying every user on every login.

Core Principles

Security Defaults is a free, one-toggle baseline with fixed behavior for everyone, and Conditional Access is a configurable policy system that needs a Microsoft Entra ID P1 licence or higher. Security Defaults requires all users to register for MFA, requires MFA for administrators and privileged actions, and blocks legacy authentication. You cannot run both at once: Entra asks you to turn Security Defaults off before Conditional Access policies can be enabled.

Feature Security Defaults Conditional Access
Setup One toggle Custom policies
Targeting Fixed for everyone By user, app, location, risk
Licensing Free Entra ID P1 or higher
flowchart TD A([Sign-in attempt]):::src --> B{From trusted
location?}:::q B -->|yes| C[Password only]:::soft B -->|no| D[Require MFA]:::tool C --> E[(Access granted)]:::ok D --> E classDef src fill:#DBEAFE,color:#1E293B classDef q fill:#FFEDD5,color:#1E293B classDef soft fill:#EDE9FE,color:#1E293B classDef tool fill:#326CE5,color:#FFFFFF classDef ok fill:#10B981,color:#FFFFFF
Security

Location is a weak signal on its own. A VPN or a compromised device inside a trusted network passes the check, and Microsoft's own baseline recommendation is to require MFA for all users. Use location exclusions to reduce friction only where you accept that trade-off, and combine them with sign-in risk policies (Entra ID P2) for real risk-based control.

Detailed Step-by-Step Practical Lab

  1. Check whether Security Defaults is currently enabled. You need the Security Administrator role or higher:
Bash
az rest --method get \
--uri "https://graph.microsoft.com/v1.0/policies/identitySecurityDefaultsEnforcementPolicy" \
--query "isEnabled" --output tsv
Tip

If az rest returns a permissions error, the Azure CLI's token may lack the Graph scope for policies. Read the same information in the Microsoft Entra admin center, or use Graph Explorer or Microsoft Graph PowerShell with the Policy.Read.All scope.

  1. Enable Security Defaults in the Entra admin center, since it is a tenant-wide setting. Then repeat step 1 and expect true:
◈ DIAGRAM
Portal: Microsoft Entra admin center -> Identity -> Overview -> Properties
-> Manage security defaults -> Enabled -> Save
  1. Create two emergency access (break-glass) accounts, for example breakglass1@devops.in and breakglass2@devops.in. Use long random passwords stored offline, assign the Global Administrator role, and register a phishing-resistant method such as a FIDO2 key. You will exclude both from every policy.

  2. Define the trusted location, such as your Mumbai office network:

◈ DIAGRAM
Portal: Entra admin center -> Protection -> Conditional Access -> Named locations
-> New location (IP ranges)
Name: Mumbai office
IP range: 203.0.113.0/24
Mark as trusted location: Yes
  1. Turn Security Defaults off, choosing "My organization is using Conditional Access" when prompted, then create the policy:
◈ DIAGRAM
Portal: Protection -> Conditional Access -> Policies -> New policy
Name: Require MFA outside trusted locations
Users: Include: a pilot group (for example, pilot-mfa-users)
Exclude: breakglass1@devops.in, breakglass2@devops.in
Target resources: All resources (formerly All cloud apps)
Conditions -> Locations: Include: Any location
Exclude: All trusted locations
Grant: Require multifactor authentication
Enable policy: Report-only
Common Mistake

Turning on a new policy straight to On for all users. A logic error then enforces immediately across the tenant, so always start in report-only mode and a small pilot group.

  1. Sign in as a pilot user from inside and outside the trusted network, then review what the policy would have done:
◈ DIAGRAM
Portal: Monitoring -> Sign-in logs -> pick a sign-in -> Report-only tab
(or Conditional Access -> Insights and reporting)
Expected: "Would require MFA" for the outside-network sign-in,
"Not applied" for the trusted-location sign-in
  1. When the results match your intent, change the policy from Report-only to On, and later widen it from the pilot group to all users.

  2. Verify the policy state with Graph. The state is enabledForReportingButNotEnforced in report-only mode and enabled when enforced:

Bash
az rest --method get \
--uri "https://graph.microsoft.com/v1.0/identity/conditionalAccess/policies" \
--query "value[].[displayName,state]" --output table
  1. Clean up the test tenant. Delete the policy and the named location, remove the break-glass accounts if they were only for the lab, and re-enable Security Defaults if the tenant has no other Conditional Access policies:
◈ DIAGRAM
Portal: Conditional Access -> Policies -> Require MFA outside trusted locations -> Delete
Conditional Access -> Named locations -> Mumbai office -> Delete
Properties -> Manage security defaults -> Enabled -> Save

Production Best Practices & Common Pitfalls

Security

Never disable MFA for a group that complains about friction. Narrow where it applies with Conditional Access, such as registered compliant devices or trusted networks, instead of removing the protection.

Tip

Roll out in stages: report-only, then a pilot group, then everyone. A mistake in a pilot locks out ten people, not the whole company.

Remember

Security Defaults and Conditional Access do not run together. Once you adopt Conditional Access, your own policies must cover what Security Defaults covered, including admin MFA and blocking legacy authentication.

  • Keep two break-glass accounts. Exclude both from every Conditional Access policy, store credentials offline, and alert on any sign-in they make. A policy mistake that locks out every administrator is hard to recover from without them.
  • Block legacy authentication explicitly. Protocols such as IMAP and SMTP basic auth cannot do MFA, so a dedicated policy should block them once Security Defaults is off.
  • Use named locations for known egress IPs only. Broad or stale IP ranges quietly weaken the policy.
  • Prefer phishing-resistant methods for administrators. Passkeys and FIDO2 keys resist the prompt-bombing attacks that defeat push approvals.
  • Review sign-in logs after rollout. Failed or interrupted sign-ins from service accounts and scripts often appear after enforcement, so exclude or migrate them deliberately.

Quick Reference & Troubleshooting Commands

Command Description
az rest --method get --uri ".../identitySecurityDefaultsEnforcementPolicy" Check Security Defaults status
az rest --method get --uri ".../conditionalAccess/policies" List Conditional Access policies and their state
az rest --method delete --uri ".../conditionalAccess/policies/POLICY_ID" Delete a Conditional Access policy
az ad user list List users a policy might apply to
az ad group member list Check group membership for a pilot rollout

Explore More in Azure Monitoring, Identity, and Production Readiness

All 6 Topics

Frequently Asked Questions

Is Enforcing MFA with Conditional Access free to learn on DevOps Network?

Yes - this topic, like everything on DevOps Network, is 100% free with no paywall or sign-up gate.

What does the Enforcing MFA with Conditional Access topic cover?

Learn to configure Conditional Access policies that require MFA based on real risk signals like location, rather than for every single login.

Found a mistake, an outdated step or a broken link?