Free tech learning for everyone, from basics to pro

Cloud LabsLabsIntermediate

Lab: Microsoft Entra ID MFA and conditional access basics

In short: You build one conditional access policy that requires multi-factor authentication for a test user, starting in report-only mode. Along the way you learn why an excluded emergency account matters, how to read sign-in logs and how to roll back safely.

Aim and what you need

The aim is to require multi-factor authentication (MFA) for a test user with a conditional access (CA) policy in Microsoft Entra ID, the identity service behind Microsoft 365 and Azure. CA is an if-then engine: if a sign-in matches the conditions, then grant access, demand MFA or block.

  • A separate test tenant, never your employer's or school's production tenant. A free Azure account creates one for you.
  • Entra ID P1 licensing for CA. A time-limited trial is usually enough; set a calendar reminder for when it ends.
  • An authenticator app on your phone and a second browser profile for the test user.
  • Optional: PowerShell 7 with the Microsoft Graph module, or the Azure CLI (command-line interface).

Warning: protect the tenant's own global administrator with MFA before anything else, and keep a spending budget on the subscription (see the budget alerts lab).

Lab topology: test tenantTest tenantfree or trialBreak-glassexcluded adminTest userlab accountCA policyreport-onlyfirstSign-in logscheck result
Figure 1. The lab runs in a separate test tenant: a protected emergency admin, one test user and one policy you watch in the logs.

Steps

  1. Sign in to the Entra admin centre as global administrator and register MFA for that account.
  2. Create a break-glass (emergency access) account with a long random password stored offline. You will exclude it from every policy so a mistake cannot lock you out.
  3. Create the test user and a group for the pilot.
  4. CA cannot run alongside security defaults. Under Entra ID, Overview, Properties, turn security defaults off only once you are ready to create your own policy straight away.
  5. Go to Protection, Conditional Access, New policy. Name it LAB-Require-MFA-Pilot. Users: include the pilot group, exclude the break-glass account. Target resources: all cloud apps. Grant: require multifactor authentication. Enable policy: Report-only.
  6. Sign in as the test user in the second browser profile, then review the sign-in log entry and its Report-only tab.
  7. When the result looks right, switch the policy to On, sign in again and register the authenticator app when asked.

The same objects can be created from the command line:

az login
az ad user create --display-name "Lab User" --user-principal-name labuser@<yourtenant>.onmicrosoft.com --password "<temporary-password>" --force-change-password-next-sign-in true
az ad group create --display-name "LAB-MFA-Pilot" --mail-nickname labmfapilot
az ad group member add --group "LAB-MFA-Pilot" --member-id <user-object-id>

Install-Module Microsoft.Graph -Scope CurrentUser
Connect-MgGraph -Scopes "Policy.Read.All","Policy.ReadWrite.ConditionalAccess","AuditLog.Read.All"
Get-MgIdentityConditionalAccessPolicy | Select-Object DisplayName, State
How a conditional access policy decidesAssignmentswho and which appsConditionslocation, device, riskGrant controlsrequire MFA, blockSession controlssign-in frequencyStatereport-only or on
Figure 2. A policy is read top to bottom: who it applies to, under what conditions, what it demands and whether it is enforced.

How to verify

Open Entra ID, Monitoring, Sign-in logs, and select the test user's latest sign-in. The Conditional Access tab should show your policy as Success once MFA was completed, or Report-only: Failure if it would have blocked access. The What If tool on the Conditional Access page lets you test a user and app combination without signing in. Finally, sign in as the break-glass account and confirm the policy shows as Not applied.

Troubleshooting and clean-up

  • Policy not listed in the log: check the user is really in the pilot group and the policy is saved.
  • Locked out: sign in with the break-glass account and set the policy to Off. This is exactly why you made it.
  • Cannot turn on the policy: security defaults are still enabled, or the licence trial has ended.
  • Prompted too often: look at session controls such as sign-in frequency.

To clean up, set the policy to Off and delete it, remove the test user and group, cancel any trial you do not want to renew, and if the tenant was only for this lab, delete any Azure subscription in it. Write down what you did: a short change log is good practice at work and a handy portfolio item.

Tip: in real organisations, CA changes go through change control and always start in report-only mode for a few days.

Practice

Why must the break-glass account be excluded from the policy?
So that a faulty policy or an MFA outage cannot lock every administrator out of the tenant.
What does report-only mode do?
It evaluates the policy and records what would have happened in the sign-in logs, without enforcing it.
Why could you not create the policy while security defaults were on?
Security defaults and conditional access are alternatives; Entra ID requires security defaults to be off before custom CA policies can be enforced.

Key takeaways

  • Always use a separate test tenant, never production.
  • Create and exclude a break-glass account before any policy.
  • Start in report-only mode and read the sign-in logs.
  • The What If tool tests a policy without a real sign-in.
  • Clean up trials, users and subscriptions when finished.
Tracks your learning on this device only. See your progress on the learning paths.

About the author

Mohamed Fayas

Founder of FM TecHub. CCNA certified, with a BTEC HND in Network Engineering, and BEng (Hons) in Computer Networking and Cloud Security. He writes practical, plain-English guides on networking, security and cloud.

More about the author

Original content written by Mohamed Fayas for FM TecHub. © 2026 FM TecHub. You're welcome to share a link to this page; please don't copy the text elsewhere without permission.

Stay up to date by email

New notes, tools and security news from FM TecHub, explained simply. Free.

We only use your email to send these updates. See our privacy policy.