Restrict device code flow
ZTA.21808 is in Maester 3.0.0-preview and not in the stable 2.3.0 release yet. It will be in the next stable release. To use it now, install the preview:
Install-Module Maester -AllowPrerelease -ForceHow to get the preview, and go backUse the preview in GitHub Actions
CIS.M365.5.2.2.12 (Ensure the device code sign-in flow is blocked) checks the same setting. Running both reports it twice.
Overview
Section titled “Overview”Device code flow is a cross-device authentication flow designed for input-constrained devices. It can be exploited in phishing attacks, where an attacker initiates the flow and tricks a user into completing it on their device, thereby sending the user’s tokens to the attacker. Given the security risks and the infrequent legitimate use of device code flow, you should enable a Conditional Access policy to block this flow by default.
Remediation
Section titled “Remediation”Run it
Section titled “Run it”The check runs as part of the whole assessment, with the ZeroTrustAssessment module installed:
Install-Module ZeroTrustAssessment -Scope CurrentUserConnect-MaesterInvoke-Maester -Pack ZTA -SkipBuiltInLeave out -SkipBuiltIn to run Maester’s own checks in the same run.
About this check
| Severity | High |
| Effort to fix | Low |
| Impact on users | Medium |
| Pillar | Identity |
| Category | Access control |
| Product | Entra ID |
| Feature | Conditional Access |
| Area | Authentication |
| ATT&CK | T1528 Steal Application Access Token, T1566.002 Spearphishing Link |
| Licence | P1 |
| Tenant | Workforce, External |
Product, feature, area and ATT&CK are Maester’s: the assessment does not record them, so Maester keeps them in the pack’s taxonomy.json.
A Microsoft check, part of the Zero Trust Assessment pack. Text from ZeroTrustAssessment 3.1.0, © Microsoft, MIT licence.
About this check
- Severity
- High
- Effort to fix
- Low
- Impact on users
- Medium
- Product
- Entra ID
- Feature
- Conditional Access
- Area
- Authentication
- Pack
- Microsoft Zero Trust Assessment