Join our Newsletter — 33% off our NHI Course
Home› FAQ› Authentication, Authorisation & Trust› How do you block device code flow with…
Authentication, Authorisation & Trust

How do you block device code flow with Conditional Access in Microsoft Entra ID?

← Back to all FAQ
By NHI Mgmt Group Editorial Team Updated October 20, 2026 Domain: Authentication, Authorisation & Trust

You block device code flow in Microsoft Entra ID by creating a Conditional Access policy that targets the device code authentication flow and blocks it for the chosen users or apps. Exclude break-glass accounts, test in report-only mode first, and watch sign-in logs for blocked attempts and legitimate clients that still depend on it.

What device code flow is doing in Entra ID

device code flow is an OAuth device authorization grant that lets a user start sign-in on one device and complete authentication on another, usually when the first device cannot easily present a browser or keyboard. In microsoft entra id, that convenience is also the reason many teams choose to block it: the flow can bypass assumptions built around browser-based, device-bound, or phishing-resistant sign-in patterns.

The practical question is not whether the flow exists, but which clients genuinely need it. That includes older devices, command-line tools, and some remote or constrained environments. If your estate does not need those use cases, the policy decision is straightforward, because the control point sits at authentication policy rather than at the application itself.

When teams want a broader design view of the policy trade-offs, the Conditional Access Guide is the most direct reference for policy design, exclusions, report-only validation and access gaps.

How to block the flow without breaking legitimate access

You block device code flow by targeting the authentication flow in a Conditional Access policy and setting the action to block for the chosen users or apps. The control works best when you scope it deliberately, instead of trying to apply one blanket rule everywhere. Break-glass accounts should be excluded, because they are there for recovery when your normal policy stack is failing or unavailable.

Start in report-only mode and review sign-in logs before enforcing. That gives you a way to see which users, scripts, or native clients still depend on the flow, and it helps you separate legacy dependency from actual misuse. If a legitimate client still requires device code flow, decide whether the client should be modernised, replaced, or isolated to a smaller population rather than exempting the whole tenant.

For organisations hardening their Microsoft Entra ID posture more broadly, the Microsoft 365 Security Guide provides the adjacent sign-in, audit, app consent and policy controls that make Conditional Access more effective.

When the issue is not just device code flow but the wider identity perimeter, the Zero Trust Identity Guide helps place the block inside a broader identity-centric policy model.

What to verify after you enforce the block

Once the policy is active, verify two things: that blocked device code attempts are actually being denied, and that critical workflows are still succeeding through approved sign-in methods. The useful evidence is in the sign-in logs, where you can distinguish policy enforcement from unrelated authentication failures. That matters because a block can look successful on paper while a dependent automation job or admin workflow quietly fails elsewhere.

Also check for uneven client behaviour. Some tools surface the block clearly, while others retry in ways that hide the real root cause. If you see repeated blocked attempts from a known endpoint or service, treat that as a signal that the dependency is still active and should be remediated, not as a one-time nuisance.

If the client is actually a legacy protocol or OAuth integration that you still need to support, the OAuth 2.0 and OpenID Connect Guide for Identity Teams is a useful companion for separating grant-type behaviour from the policy decision.

Risk and Threat Considerations

Device code flow is attractive because it reduces friction for constrained clients, but that same flexibility can weaken your normal sign-in assumptions. It can also be abused in phishing-style social engineering, where a user is pushed to authenticate on a separate device without the usual browser context they expect. If the flow remains enabled broadly, you are accepting a wider trust boundary than many teams realise.

Failure mechanism: The policy is scoped too broadly, excluded too generously, or not validated in report-only mode, so the tenant keeps accepting a sign-in path that should have been removed. A second failure mode is operational drift, where a newly introduced client quietly depends on the flow and normalises its use again.

Impact: Attackers and opportunistic abuse gain another route to capture or relay a valid sign-in, while defenders lose a cleaner enforcement point for modern authentication expectations. The operational impact is also real, because blocked legitimate clients can produce support tickets, broken automations, and exceptions that slowly undo the original control.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

NIST SP 800-53 Rev 5 and CIS Controls v8 set the technical controls, while ISO/IEC 27001:2022 defines the regulatory obligations.

FrameworkControl / ReferenceRelevance
NIST SP 800-53 Rev 5IA-5 — Authenticator ManagementDevice code flow depends on credential and token handling, so managing authenticators is central.
AC-2 — Account ManagementBlocking a sign-in flow requires scoping which users and accounts remain allowed or excluded.
AU-2 — Event LoggingValidation depends on sign-in evidence showing blocked attempts and remaining dependencies.
Recommendation — Manage and rotate authentication material so sign-in methods stay controlled and revocable. Restrict the policy to approved accounts and exclude recovery identities from normal enforcement. Log authentication events and review them to confirm the block is working as intended.
ISO/IEC 27001:2022A.5.15 — Access controlConditional Access is an access-control decision about who may authenticate and how.
Recommendation — Apply and document access rules that block the unwanted authentication flow.
CIS Controls v8CIS-6 — Access Control ManagementThe change is an access-control restriction on an authentication method.
Recommendation — Restrict authentication paths that are no longer needed and review exceptions tightly.

Practitioner Guidance

What to prioritise: Treat this as a tenant-wide policy decision first, not as an app-by-app exception exercise. If you already know which users and apps do not need device code flow, block it there first and keep the recovery accounts out of scope.

What to verify: Before enforcing, confirm that your sign-in logs can show both blocked attempts and the clients still depending on the flow. If you cannot explain every remaining dependency, the policy is too early for full enforcement.

Practitioner takeaway: The right implementation is usually a narrow block with evidence-driven exceptions, not a blanket rule followed by emergency exclusions after users start failing.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

NHIMG Editorial Note
Reviewed and updated by the NHIMG editorial team on October 20, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org