Identity Bytes // IB-ENTRA-SEC Track
Intermediate Lab 10 of 12 Est. 100 minutes

Detection: Defender for Identity and Identity Protection

Prevention will fail eventually, so you assume breach and detect it. This lab turns the leaked-credential signal your Password Hash Sync enabled into risk-based Conditional Access, then deploys Microsoft Defender for Identity sensors that watch the on-premises components you hardened in Lab 09, detecting DCSync, Golden Ticket and lateral movement in real time.

Section 1

Lab Metadata

Lab ID
IB-ENTRA-SEC-10
Difficulty
Intermediate
Scenario Org
Northgate Financial
Estimated Time
100 minutes

Core technologies

Microsoft Entra ID Protection Risk-based Conditional Access Microsoft Defender for Identity Defender XDR Identity Security Posture Zero Trust Microsoft Graph PowerShell
Section 2

Scenario and Description

IN PLAIN TERMS Good locks keep most people out, but a sensible building also has cameras and a guard who notices when a badge is used in two cities an hour apart, or turns up on a list of stolen badges. This lab adds that watchful layer. It challenges a sign-in that looks wrong the moment it happens, and places sensors in the on-premises server rooms to spot a burglar who is already inside quietly trying doors. Prevention, plus the sensible assumption that someone will eventually get through.

Labs 01 to 09 raised the walls: strong authentication, enforced MFA, phishing-resistant keys, just-in-time privilege, clean hygiene and a hardened hybrid bridge. A mature programme accepts that walls are eventually breached and builds the second half of the picture, detection and response. This is the "assume breach" pillar of Zero Trust, and it is where the brief's Defender for Identity and Zero Trust requirements live.

Two Microsoft capabilities cover the identity attack surface. Microsoft Entra ID Protection watches cloud sign-ins and accounts, scoring each for risk: leaked credentials (surfaced because you enabled Password Hash Sync in Lab 09), impossible travel, anonymous IP addresses, unfamiliar sign-in properties and more. Those risk scores can drive Conditional Access in real time, demanding MFA on a risky sign-in or a secure password change on a risky user. Microsoft Defender for Identity watches the on-premises side, sensors on your domain controllers and other identity servers detect reconnaissance, DCSync, Golden Ticket, Pass-the-Hash and lateral movement, exactly the techniques the Lab 09 hardening aims to prevent.

You will read the tenant's current risk state from Graph, build risk-based Conditional Access policies in report-only, walk the risk remediation flow, then plan and understand a Defender for Identity deployment and its Identity Security Posture recommendations, which will point straight back at the hardening you did in Lab 09.

Section 3

Prerequisites

Prior labs

Labs 01, 03, 05 and 09 recommended. Risk-based Conditional Access builds on the policy and break-glass patterns from Lab 03, user-risk password change relies on SSPR from Lab 05, and leaked-credential detection depends on Password Hash Sync from Lab 09. ID Protection requires Entra ID P2 (your trial). Defender for Identity requires its own licence, covered by a Microsoft 365 E5 trial.

Graph scopes introduced

ScopeWhy it is needed
IdentityRiskyUser.Read.AllRead risky users and their risk state
IdentityRiskEvent.Read.AllRead individual risk detections
Policy.ReadWrite.ConditionalAccessCreate the risk-based Conditional Access policies
Section 4

Real-World Problem Statement

Static controls treat every sign-in the same. But a sign-in from a user whose password just appeared in a breach dump, from an anonymous proxy, in a country they have never visited, is not the same as their normal morning login. Detection turns those differences into signals, and risk-based access turns signals into proportionate, automatic responses. Without it, you either over-challenge everyone or miss the sign-ins that matter.

DimensionWhy this matters
RiskReal-time risk signals catch compromise that static rules miss, and respond before an attacker moves laterally.
ComplianceContinuous monitoring and a documented response to identity threats are core to Zero Trust and audit expectations.
ProductivityRisk-based challenges fall only on risky sign-ins, so normal users are not burdened, adaptive rather than blanket friction.
Security postureDetection closes the loop: the walls from earlier labs plus the ability to see and stop what gets through.

Concrete scenario: Northgate wants leaked-credential and impossible-travel sign-ins challenged automatically, high-risk users forced through a secure password reset, and its domain controllers watched for DCSync and Golden Ticket activity, with alerts flowing to the security team in one portal.

Section 5

Skills Mapped to Production Solutions

Skill learned in this labReal-world enterprise application
Reading risky users and detections via GraphProgrammatic risk reporting and integration into SOC workflows
Building risk-based Conditional AccessAdaptive, proportionate access control driven by real-time signals
Designing the risk remediation flowSelf-service and admin response to compromised accounts
Deploying Defender for Identity sensorsOn-premises identity threat detection on domain controllers
Acting on Identity Security Posture assessmentsClosing the exposures that enable lateral movement
Section 6

Architecture Overview

Two detection engines cover the two halves of identity. ID Protection scores cloud sign-ins and users, feeding Conditional Access. Defender for Identity sensors watch on-premises identity servers. Both surface in the Microsoft Defender XDR portal for a single view.

ID Protection (cloud) leaked creds, impossible travel anonymous IP, unfamiliar sign-in Defender for Identity sensors on DCs / AD CS / AD FS DCSync, Golden Ticket, PtH lateral movement paths Risk signals user risk + sign-in risk on-prem alerts Risk-based CA MFA on risky sign-in password change on risky user Defender XDR portal unified alerts + investigation posture assessments
PRODUCTION CONSIDERATION Roll risk-based Conditional Access out in report-only first, exactly as in Lab 03. Risk policies act on signals that can occasionally misfire, an over-eager high-risk block could lock out a genuine user. Report-only lets you see how often each risk level would trigger before you enforce, and tune the thresholds to your tolerance.
Section 7

Step-by-Step Implementation

Phase A - Read the current risk state

1Query risky users and risk detections

Purpose: see what ID Protection already knows before you act on it.

Read risky users and detections from Graph
Connect-MgGraph -Scopes 'IdentityRiskyUser.Read.All','IdentityRiskEvent.Read.All',
  'Policy.ReadWrite.ConditionalAccess','Directory.Read.All' -NoWelcome

# Current risky users, highest risk first.
Get-MgRiskyUser -All |
  Select-Object UserPrincipalName, RiskLevel, RiskState, RiskLastUpdatedDateTime |
  Sort-Object RiskLevel -Descending | Format-Table -AutoSize

# Individual risk detections (the events behind the scores).
Get-MgRiskDetection -Top 20 |
  Select-Object UserPrincipalName, RiskEventType, RiskLevel, DetectedDateTime, IpAddress |
  Format-Table -AutoSize
INFO: a quiet report is normal A new lab tenant with little sign-in history will show few or no detections. That is expected. The value is knowing the query, so that in a live tenant you can pull the risk picture on demand and feed it to your SOC. Leaked-credential detections in particular only appear once Password Hash Sync (Lab 09) is enabled.

Phase B - Risk-based Conditional Access

REAL WORLD ANALOGYThink of your bank card. One odd transaction gets you a quick verification text, that is sign-in risk, challenge this one event. But if your card number turns up on a stolen list, the bank cancels the card and posts a new one, that is user risk, the credential itself is suspect, so the response is a secure password change. Two different problems, two proportionate responses, both automatic.

2Create sign-in risk and user risk policies in report-only

Purpose: respond automatically and proportionately to risk, without enforcing until validated.

Build CA003 (sign-in risk) and CA004 (user risk)
# Reuse the break-glass exclusion group from Lab 03.
$bg = Get-MgGroup -Filter "displayName eq 'CA-Exclude-BreakGlass'"

# CA003: require MFA when the SIGN-IN is medium or high risk.
$signInRisk = @{
  displayName = 'CA003 - Require MFA on sign-in risk'
  state = 'enabledForReportingButNotEnforced'
  conditions = @{
    users = @{ includeUsers = @('All'); excludeGroups = @($bg.Id) }
    applications = @{ includeApplications = @('All') }
    signInRiskLevels = @('high','medium')
  }
  grantControls = @{ operator = 'OR'; builtInControls = @('mfa') }
}
$ca003 = New-MgIdentityConditionalAccessPolicy -BodyParameter $signInRisk

# CA004: require MFA + secure password change when the USER is high risk.
# passwordChange needs SSPR enabled (Lab 05) and works for cloud/synced users.
$userRisk = @{
  displayName = 'CA004 - Secure password change on high user risk'
  state = 'enabledForReportingButNotEnforced'
  conditions = @{
    users = @{ includeUsers = @('All'); excludeGroups = @($bg.Id) }
    applications = @{ includeApplications = @('All') }
    userRiskLevels = @('high')
  }
  grantControls = @{ operator = 'AND'; builtInControls = @('mfa','passwordChange') }
}
$ca004 = New-MgIdentityConditionalAccessPolicy -BodyParameter $userRisk
VERIFICATION Both policies exist in state enabledForReportingButNotEnforced. Confirm with Get-MgIdentityConditionalAccessPolicy. Watch the report-only results in the sign-in logs over a few days, then flip to enabled using the same pattern as Lab 03.
SECURITY WARNING As with all Conditional Access, keep break-glass excluded and validate in report-only. A user-risk policy that blocks rather than remediates can trap a legitimate user whose risk was raised by a false positive, so start with remediation controls (MFA plus password change), not a block.

Phase C - The remediation flow

REAL WORLD ANALOGYSelf-remediation is the customer confirming the odd transaction themselves via the banking app: the flag clears in seconds with no human at the bank involved. Admin remediation is the fraud team stepping in for the cases that need judgement. Enterprises aim for the first path to handle the volume, reserving analysts for genuine incidents, which is exactly what the two policies you just built achieve.

3Understand self-remediation and admin remediation

Purpose: know how risk is cleared, automatically by the user or manually by an admin.

The two remediation paths
# SELF-REMEDIATION (preferred, automatic):
#  - Sign-in risk: the user completing MFA on the risky sign-in clears it.
#  - User risk: the user performing a secure password change (via SSPR)
#    clears the user risk. CA004 drives exactly this.
#
# ADMIN REMEDIATION (manual, in the Entra / Defender portal or via Graph):
#  - Confirm compromised: raises the user to high risk, forcing remediation.
#  - Dismiss risk: clears risk you have investigated and deem safe.
#  - Confirm safe: marks a detection as a false positive to tune the model.
#
# Example: confirm a user compromised via Graph (investigate first).
# $u = Get-MgUser -Filter "userPrincipalName eq 'suspect@contoso.com'"
# Confirm-MgRiskyUserCompromised -BodyParameter @{ userIds = @($u.Id) }
# Dismissal and confirm-safe are available in the portal and via the
# riskyUsers dismiss action.
PRODUCTION CONSIDERATION Favour self-remediation. A well-built user-risk policy resolves most compromised-credential cases without a human, the user is challenged, changes their password securely, and risk clears, all logged. Reserve admin confirm-compromised for investigated incidents, and use confirm-safe sparingly to teach the model about genuine false positives.

Phase D - Defender for Identity on the on-premises side

REAL WORLD ANALOGYFront-door checks assume the burglar is outside. Defender for Identity is the CCTV inside the server rooms, watching for someone who is already past the front door and quietly trying handles: an account suddenly reading the master key cabinet (DCSync), a forged staff pass (Golden Ticket), or someone walking floor to floor testing doors (lateral movement). Its posture reports also double as a safety inspector, pointing at the exact locks Lab 09 told you to change.

4Plan and deploy Defender for Identity sensors

Purpose: detect on-premises identity attacks against the servers you hardened in Lab 09.

Context: Defender for Identity runs a lightweight sensor on identity servers. It needs a licence (Microsoft 365 E5 trial covers it) and, for a real deployment, domain controllers to install on.

Deployment steps and what the sensors detect
# DEPLOYMENT (Microsoft Defender portal: security.microsoft.com):
#  1. Settings > Identities: the workspace is created automatically.
#  2. Configure a Directory Service account (a gMSA is recommended) so the
#     sensor can query AD.
#  3. Download the sensor package and its access key.
#  4. Install the sensor on each domain controller, and on AD CS, AD FS and
#     the Entra Connect server where present.
#  5. Sensors auto-update and stream to Defender XDR, no port mirroring needed.
#
# WHAT IT DETECTS (mapped to attacks from earlier labs):
#  - Suspected DCSync attack        -> the sync-account risk from Lab 09
#  - Golden Ticket / forged tickets -> Kerberos abuse
#  - Pass-the-Hash / Pass-the-Ticket / Overpass-the-Hash
#  - Reconnaissance and enumeration (LDAP, SMB, account probing)
#  - Suspected brute force, AS-REP roasting, Kerberoasting
#  - Lateral movement paths to sensitive accounts
INFO: posture assessments point back at Lab 09 Defender for Identity includes Identity Security Posture assessments that proactively recommend fixes, for example rotating the Seamless SSO AZUREADSSOACC Kerberos key, removing unconstrained Kerberos delegation, and eliminating clear-text credential exposure. These are the exact hardening actions from Lab 09, now surfaced and tracked as a managed posture score.

Phase E - Tie it together as Zero Trust

5See the whole track as one Zero Trust posture

Purpose: connect every lab to the three Zero Trust principles.

The track mapped to Zero Trust
# VERIFY EXPLICITLY
#  - MFA and phishing-resistant auth (Labs 02-04)
#  - Risk-based Conditional Access using real-time signals (this lab)
#
# USE LEAST-PRIVILEGE ACCESS
#  - Just-in-time PIM activation (Lab 07)
#  - Access reviews and hygiene (Lab 08)
#
# ASSUME BREACH
#  - Detection with ID Protection and Defender for Identity (this lab)
#  - Hardened, monitored hybrid bridge (Lab 09)
#  - Automated response: risk remediation, account disablement (Lab 06)

What just happened? The individual controls resolve into a coherent posture. You verify explicitly with strong, risk-aware authentication, grant the least privilege for the shortest time, and assume breach by detecting and responding across both cloud and on-premises identity. That is the Zero Trust identity programme the brief asks for.

Section 8

Testing and Validation

  1. Risk read: run Phase A and confirm you can pull risky users and detections.
  2. Policies: confirm CA003 and CA004 exist in report-only, excluding break-glass.
  3. Simulated risk: sign in through an anonymous VPN or Tor to generate a sign-in risk detection, then observe the report-only result in the sign-in logs.
  4. Self-remediation: as a test user marked at risk, confirm a secure password change clears user risk.
  5. Defender for Identity: if you have a lab DC, install a sensor and confirm it reports healthy in the Defender portal.
SymptomCauseResolution
No leaked-credential detections everPassword Hash Sync not enabledEnable PHS (Lab 09), leaked-credential relies on it
passwordChange control failsSSPR not enabled or federated userEnable SSPR (Lab 05), password change requires it
Risk policy blocks a genuine userFalse-positive high risk with a block controlUse remediation controls not block, and confirm-safe the false positive
Sensor unhealthyDirectory Service account or connectivity issueVerify the gMSA and outbound connectivity to the Defender service
Section 9

Security Analysis

What makes this sound

Intentionally simplified for the lab

Production hardening

Section 10

Cleanup Instructions

Remove the risk-based policies (reset only)
foreach ($name in 'CA003 - Require MFA on sign-in risk','CA004 - Secure password change on high user risk') {
  $p = Get-MgIdentityConditionalAccessPolicy -Filter "displayName eq '$name'"
  if ($p) { Remove-MgIdentityConditionalAccessPolicy -ConditionalAccessPolicyId $p.Id }
}
Disconnect-MgGraph
INFO: preserve for the track Keep the risk policies in report-only, Lab 12 reports on their would-be impact as part of the posture story.
Section 12

Key Takeaways and Next Lab

Identity Bytes // IB-ENTRA-SEC Track // Lab 10 of 12. British English. For lab and training use against a disposable tenant only.