MFA, Security Defaults and Conditional Access

Conditional Access policies are the “if this, then that” rules of Microsoft Entra ID. If an admin signs in to Azure, ask for MFA, and if someone from the helpdesk group tries to manage Azure from outside the office network, block it.

Your tenant has run on security defaults since Lesson 2, which gives everyone a basic MFA setup with no options to change. Conditional Access swaps that for your own rules per user, app, location and device. You need Entra ID P1 or P2 for it, so in this lesson you’ll start the 30-day P2 trial.

The lab follows the same safe order teams use at work: plan the policy, build it in report-only mode, test it with the What If tool, then switch it on, and always keep a way back in case something goes wrong.

TimeYou needCostBy the end you can
About 60 minutesThe account owner login, Asha’s login, a private browser windowNothing (30-day Entra ID P2 trial)Replace security defaults with Conditional Access safely and read a policy block from the sign-in logs

What it is, in one line

Conditional Access checks each sign-in against your rules (who, which app, from where, on what device) and then lets it through, asks for MFA or blocks it.

In Simple Words

The security guard with a rule book

Think of a building with one guard at the gate. Under security defaults the guard has one rule for everybody: “show your ID card and a code from your phone”.

With Conditional Access you hand the guard a rule book instead: “Office staff during the day only need the ID card. Anyone heading to the server room shows the ID card and the phone code. Helpdesk staff coming in from outside the city don’t get into the server room at all.”

And before a new rule goes live, a careful manager asks the guard to spend a week only writing down what he would have done. That’s report-only mode.

Engineer's View

What a policy is made of

  • Assignments: the users (include and exclude users, groups and roles), the target resources (apps like “Windows Azure Service Management API”, which covers the portal, CLI and PowerShell), and the conditions (locations, device platforms, client apps, and sign-in risk with P2).
  • Access controls: grant (block, or require MFA, a compliant device, an authentication strength) and session (sign-in frequency and similar).
  • State: Off, Report-only or On. A report-only policy is evaluated at each sign-in and the result goes into the sign-in logs, but nothing is enforced.

All the policies that apply to a sign-in get evaluated, every grant control they ask for has to be met, and a block in any one of them wins. Policies kick in after the first factor (the password) has been checked.

You can’t have security defaults and Conditional Access on together. The moment you turn security defaults off, the baseline MFA rules disappear, so build the replacement MFA policy in the same sitting. Tenants with P1 or P2 may also get Microsoft-managed policies, which Microsoft creates in report-only mode for you to look over.

When a policy blocks a sign-in, the user sees error AADSTS53003, saying access has been blocked by Conditional Access policies. In the sign-in log entry, the Conditional Access tab shows you which policy did it.

Two safety rules matter here. Keep two emergency access accounts excluded from blocking policies (they still need phishing-resistant MFA, because mandatory MFA covers them too), and don’t ever switch a policy straight to On without a report-only period and a What If test.

How it works, step by step

This is how Entra ID applies Conditional Access to a single sign-in:

Conditional Access policies evaluation for one sign-in
  1. The user enters a username and password (first factor).
  2. Entra ID gathers signals: the user and their groups, the app they’re signing in to, the IP address and named location, the device platform, and risk (with P2).
  3. It picks out each policy whose assignments match those signals.
  4. Report-only policies get recorded and not enforced. The enforced ones are combined, so any block wins, and if there’s no block, every required control has to be satisfied.
  5. If MFA is required and the user hasn’t done it yet, they’re asked for it. Then either a token is issued or AADSTS53003 comes back.

The What If tool in the portal runs the same evaluation for a pretend sign-in (“Asha, Azure management, from this IP”) and shows which policies would apply. It’s the quickest way to test a policy before anyone gets locked out.

Conditional Access policies safe rollout: report-only, What If, then On

In the lab you’ll swap security defaults for one MFA policy covering everyone, add a stricter rule for the helpdesk group, test that in report-only mode, and then watch it block Asha.

Hands-on lab: replace security defaults safely

Before you run any command, double-check it

Read every command twice before you press Enter. Check the target: the system or account, the IDs, the names and the sizes. These commands are for learning and were tested in our lab, not on your system. At work, run the read-only list commands first, follow your change process, make sure a backup exists, and ask a second person to check anything that changes or deletes data. You run them at your own risk.

You’ll spend most of this lab in the Microsoft Entra admin center at entra.microsoft.com, since that’s where Conditional Access lives. The CLI is only for finding your IP address and testing Asha’s sign-in. Go through the steps in order.

1Start the Entra ID P2 trial and license Asha

  1. Sign in to entra.microsoft.com as the account owner.
  2. Go to Billing > Licenses > All products > Try / Buy, open Microsoft Entra ID P2 and choose Activate for the trial.
  3. Give it a few minutes, then open Users > Asha Rao > Properties and set Usage location to India, because you can’t assign a licence without a usage location.
  4. Open Licenses on Asha’s page, choose Assignments, tick Microsoft Entra ID P2 and save. Then do the same for Ravi.
Entra ID P2 licence assignment for a user
Asha with usage location India and an Entra ID P2 licence.

2Find your public IP and create a named location

In Windows PowerShell, run this:

(Invoke-RestMethod -Uri 'https://ifconfig.me/ip').Trim()

You should see something like this:

49.37.112.18

In the Entra admin center, go to Protection > Conditional Access > Named locations > IP ranges location. Call it loc-saat-office, add your IP with /32 on the end (for example 49.37.112.18/32) and tick Mark as trusted location. Home and mobile IPs do change now and then, so if yours does, update this range.

3Turn off security defaults and add an MFA policy at once

  1. Go to Identity > Overview > Properties > Manage security defaults, set it to Disabled, pick the reason “My organization is planning to use Conditional Access” and save.
  2. Then go straight to Conditional Access > Create new policy and name it CA01 Require MFA for all users.
  3. Users: Include All users. Target resources: All resources. Grant: Require multifactor authentication.
  4. Enable policy: On. Create.

This one can go straight to On because all it does is replace what security defaults were already doing, MFA for everyone. You’ve already set up MFA, so it won’t lock you out.

Conditional Access policies list with CA01 on
CA01 created and On.

4Build a stricter helpdesk rule in report-only mode

Now create a second policy called CA02 Block Azure management for helpdesk outside office:

  • Users: Include the group grp-saat-helpdesk.
  • Target resources: Select resources > Windows Azure Service Management API, which covers the portal, Azure CLI and Azure PowerShell.
  • Network (under Conditions): Configure Yes, Include Any network or location, Exclude Selected networks and locations > loc-saat-office.
  • Grant: Block access.
  • Enable policy: Report-only. Create.

Put simply: “if someone in the helpdesk group signs in to Azure management from anywhere other than the office IP, block it”. For now it only reports.

5Sign in as Asha and read the report

Open a second PowerShell window (Asha’s window) and sign in as her:

$env:AZURE_CONFIG_DIR = 'C:\azure-lab\asha-cli'
az login --tenant <your-tenant-id> --allow-no-subscriptions
az account show --query user.name -o tsv

You should see something like this:

asha.rao@priyakoutlook.onmicrosoft.com

She gets in, since she’s on the office IP and the policy is only reporting anyway. Now go to Monitoring & health > Sign-in logs in the Entra admin center, pick Asha’s latest sign-in to “Azure CLI” and open the Report-only tab. CA02 shows Report-only: Not applied, because her location was excluded.

That’s the result you want before you switch it on.

Conditional Access report-only result in Entra sign-in logs
Asha’s sign-in, Report-only tab: CA02 was evaluated and not applied.
Conditional Access policies lab: Asha signs in and CA02 is reported not applied
Example output. Your IP and tenant ID will be different.

✅ Checkpoint: CA01 is On, CA02 is Report-only, and Asha’s sign-in log shows CA02 evaluated and not applied.

Break It, Then Fix It

A policy can go wrong in two ways: the rule itself is wrong, or the rule is right but would catch you as well. You’ll try both, safely.

1Break it: a wrong office IP, then switch the policy on

Edit the named location loc-saat-office and swap your IP for 203.0.113.10/32, which is an address set aside for documentation, so you’re certainly not on it. Then edit CA02 and set it to On.

In Asha’s window, sign out and back in:

az logout
az login --tenant <your-tenant-id> --allow-no-subscriptions

You’ll get an error like this:

AADSTS53003: Access has been blocked by Conditional Access policies. The access policy does not allow token issuance.

As far as Entra ID is concerned, Asha is now “outside the office”, so the block kicks in. Her entry in the sign-in logs shows Failure with error code 53003, and the Conditional Access tab lists CA02 with the result Failure. Because the log names the policy, nobody has to guess.

To fix it, put your real IP back in loc-saat-office, wait a minute and sign in again:

az login --tenant <your-tenant-id> --allow-no-subscriptions
az account show --query user.name -o tsv

You should see something like this:

asha.rao@priyakoutlook.onmicrosoft.com

2Break it (on paper): a block rule that would catch you

Say you’d copied CA02 and picked All users instead of the helpdesk group. Don’t create that. Open Conditional Access > Policies > What If instead, choose your own account, the app Windows Azure Service Management API and IP 203.0.113.10, and select What If.

Conditional Access What If results
What If for your account: only CA01 applies today.

The tool lists CA01 (MFA), and CA02 doesn’t apply because you aren’t in the helpdesk group. Had CA02 targeted All users, it would show up in the list as “Block”, and the first time you signed in from a new IP, your phone’s mobile data for instance, you’d be locked out of Azure.

At work, the fix is two emergency access accounts left out of every blocking policy, a What If check before each change, and report-only first. In this lab you’re the only admin, so the rule is: never point a block at All users.

3Clean up

The P2 trial runs out after 30 days, and policies don’t always behave cleanly once the licence is gone, so put the tenant back to its simple, safe state:

  1. In Asha’s window, run az logout and Remove-Item Env:AZURE_CONFIG_DIR, then delete C:\azure-lab\asha-cli.
  2. Delete CA02 first, then CA01, and then the named location loc-saat-office.
  3. Turn security defaults back on (Identity > Overview > Properties).
Conditional Access policies error AADSTS53003 after a wrong named location
Example of the block and the fix.

✅ Checkpoint: No Conditional Access policies remain, security defaults are enabled again, and Asha can still sign in with MFA.

This happened at work

The policy that locked out every admin at 2 a.m.

This was a logistics company that wanted to block sign-ins from outside India. Late one evening an engineer created a policy, “All users, All cloud apps, Exclude location: India, Block”, and switched it straight to On.

At 2 a.m. an alert went off. The on-call admin was in Singapore for a conference, and his sign-in was blocked. The second admin was on a VPN that came out in Europe, so he was blocked too. Nobody could get into the portal to change the policy, and the two emergency accounts had been deleted months before “because nobody used them”. Getting back in took a support case with Microsoft and most of the next day.

What they changed: they set up two cloud-only emergency accounts with FIDO2 keys, excluded from every policy, with an alert on any sign-in. Each new policy now sits in report-only for at least a week, and the change record has to include What If screenshots for an admin, a normal user and a travelling user. Location blocks target specific groups and apps now, not “All users, All cloud apps”.

Common mistakes and troubleshooting

MistakeWhat you seeWhat to do
Switching a new block policy straight to OnPeople, or admins, locked outReport-only first, What If, then On.
Turning off security defaults with nothing to replace themNo MFA for anyoneCreate the MFA policy in the same sitting.
No emergency accounts excludedNobody can fix a bad policyKeep two excluded break-glass accounts with FIDO2 keys and sign-in alerts.
Home or mobile IP in a trusted locationBlocks when the IP changesUse company IP ranges, or compliant devices, rather than home IPs.
Guessing which policy blocked someoneHours of trial and errorOpen the sign-in log, where the Conditional Access tab names the policy and the result.
Expecting a report-only policy to block“The policy doesn’t work”Report-only never enforces anything. Look at the Report-only tab to see what it would have done.

Interview questions

Click a question to open it. Each one is worded the way an interviewer would put it, and underneath you’ll find why they ask it and one way you could answer in your own words.

Fresher level

1. What is Conditional Access, in simple words?

Why they ask this: They want a clear, non-jargon explanation.

How you might answer: It’s a set of if-then rules in Entra ID that run when someone signs in. If this user signs in to this app from this place or device, then let them in, ask for MFA, or block them.

2. What’s the difference between security defaults and Conditional Access?

Why they ask this: They want to know when each fits.

How you might answer: Security defaults are one fixed set of MFA rules for everybody, and every tenant gets them. With Conditional Access you write your own rules per user, app and condition, but you need Entra ID P1 or P2, and you can’t run the two together.

3. A user says “access blocked” with error 53003. Where do you look?

Why they ask this: They want the right tool, not guesses.

How you might answer: 53003 means a Conditional Access policy blocked the sign-in. I’d open that user’s entry in the Entra sign-in logs and go to the Conditional Access tab, which tells me which policy failed and why, the location for example.

2–5 years experience

4. How do you roll out a new Conditional Access policy safely?

Why they ask this: They want to hear a careful, step-by-step rollout.

How you might answer: I build it in report-only mode and leave it for a few days, watching the Report-only tab in the sign-in logs to see who it would hit. I try the edge cases in What If, an admin and someone travelling for example, and I make sure the emergency accounts are excluded. Then I switch it on during working hours after telling the affected teams, and keep an eye on sign-in failures for a day.

5. Which app would you target to protect Azure administration?

Why they ask this: They want specific knowledge about Azure management sign-ins.

How you might answer: Windows Azure Service Management API, because it covers the Azure portal, Azure CLI and Azure PowerShell. If you want every admin portal across Microsoft 365 and Entra as well, there’s the Microsoft Admin Portals option too.

6. Why should you not use home IP addresses as trusted locations?

Why they ask this: They want practical judgement about network-based controls.

How you might answer: Home and mobile IPs change, so people end up blocked or trusted for the wrong reasons, and other people can share a home IP. Location is a weak signal anyway, and device compliance or phishing-resistant MFA are much stronger. I’d use the company’s egress IP ranges for locations and ask for compliant devices for sensitive access.

Senior level

7. Design a Conditional Access baseline for a 500-person company.

Why they ask this: They want a sensible, layered set, not one giant policy.

How you might answer: I’d start with MFA for all users on all apps, then stronger phishing-resistant MFA for admin roles, a block on legacy authentication, and compliant or hybrid-joined devices for admins and sensitive apps. With P2 I’d add risk-based policies for risky sign-ins and users. Two emergency accounts stay excluded from all of it, and each policy goes through report-only and What If before it’s switched on.

8. An admin got locked out by a bad policy and there are no emergency accounts. What now?

Why they ask this: They’re checking calm recovery thinking and lessons learned.

How you might answer: First I’d see whether any other Global or Conditional Access Administrator can still sign in from somewhere the policy allows, like the office. If nobody can, it’s a support case with Microsoft, which needs proof of ownership and takes a while. Once we’re back in, I’d create two emergency accounts with FIDO2 keys, excluded from all policies, monitored, and tested each quarter.

9. How would you prove to an auditor that only the helpdesk group is blocked outside the office?

Why they ask this: They want evidence-based answers.

How you might answer: I’d export the policy settings, show What If results for a helpdesk user and a non-helpdesk user coming from an outside IP, and show sign-in log entries where CA02 applied and where it didn’t. For evidence that keeps coming, I’d send the sign-in logs to a Log Analytics workspace and keep a saved query listing all the CA02 results.

Quick quiz

Q1. What does report-only mode do?

  1. Blocks and logs
  2. Evaluates and logs, but never enforces
  3. Turns the policy off
  4. Sends an email to the user
Show answer

B — Report-only records what would have happened without enforcing it.

Q2. Which licence does Conditional Access need?

  1. Entra ID Free
  2. Entra ID P1 or P2
  3. Microsoft 365 Basic
  4. None
Show answer

B — Conditional Access is a P1 feature, and P2 includes it.

Q3. What error code does a user get when a policy blocks them?

  1. AADSTS50126
  2. AADSTS53003
  3. AADSTS700016
  4. AADSTS50076
Show answer

B — 53003 means access was blocked by Conditional Access.

Q4. Which target resource covers the Azure portal, CLI and PowerShell?

  1. Office 365
  2. Windows Azure Service Management API
  3. Microsoft Graph
  4. Azure Storage
Show answer

B — Windows Azure Service Management API covers Azure management sign-ins.

Q5. Why keep emergency access accounts excluded from blocking policies?

  1. They are cheaper
  2. So someone can still sign in if a policy goes wrong
  3. They don’t need MFA
  4. Microsoft requires it for billing
Show answer

B — They are your way back in after a bad policy.

Quick recap

You’ve swapped the one-size rule for your own, tested it the safe way and read a real block in the logs.

  • Conditional Access: if this user, app, location or device, then allow, require MFA, or block.
  • It needs Entra ID P1 or P2, and security defaults have to be off.
  • Report-only and What If always come before On.
  • AADSTS53003 means a policy blocked the sign-in; the sign-in log names it.
  • Keep emergency accounts excluded, and think twice before blocking “All users”.

Next lesson

Lesson 10: Managed identities and service principals → You’ll give an app an identity of its own, so your scripts stop carrying passwords and keys around.

Further reading: Conditional Access policies

Want to go deeper into Conditional Access policies? Microsoft’s guide is What is Conditional Access?, and the testing tool is described in Use the What If tool to troubleshoot Conditional Access policies. You can also see the full plan for this course on the Azure Cloud Administration course page.

Scroll to Top

This website uses cookies

We use a few cookies to keep this site working. If you allow it, we also use Google Analytics to count visits so we can improve our lessons. You can accept all, deny the optional ones, or choose what to allow.