Language:EN
Let's talk
← Back to insightsInsights

Block device code sign-in flow

Reading time: 3 min ·

Find out what the Block device code sign-in flow Conditional Access policy is and how to configure it in Microsoft Entra ID

Introduction

Password security can no longer be addressed solely through complexity or multi-factor authentication (MFA). Attackers have evolved their techniques and exploit alternative authentication flows that, although legitimate, can become vectors for unauthorised access if they are not properly controlled.

One of these mechanisms is the device code sign-in flow, commonly used by devices with limited input capabilities such as TVs, IoT devices or command-line tools (CLI). Without proper controls, this flow can be exploited through advanced phishing campaigns or token replay attacks.

In this context, configuring a Block device code sign-in flow Conditional Access policy in Microsoft Entra ID becomes an important measure for identity protection, password security and access control in Microsoft 365.

What is Block device code sign-in flow and what is it for?

The device code flow is an authentication flow defined in OAuth 2.0 for devices that have no browser or have limited input capabilities. It lets the authentication process be completed from a secondary device with a browser.

It works as follows:

  • The device requests a code.
  • The user enters that code on another device with a browser.
  • After authenticating, the original device receives the access token.

Although it is a legitimate mechanism in Microsoft Entra ID, attackers can use it to:

  • Trick the user into entering a code generated by the attacker.
  • Obtain valid tokens without needing to know the password.
  • Bypass certain traditional password and authentication security controls.

The Block device code sign-in flow policy blocks this type of authentication through Conditional Access in Microsoft Entra ID, reducing the attack surface associated with legacy flows and strengthening identity protection in corporate environments.

Microsoft Device Code Authentication Flow sign-in screen

Requirements for configuring Block device code sign-in flow

Before implementing a Block device code sign-in flow policy, certain technical and organisational requirements must be met:

Appropriate licensing

  • Microsoft Entra ID P1 or P2.
  • Access to Conditional Access features.

Roles and permissions

  • Global Administrator
  • Security Administrator
  • Conditional Access Administrator

Prior impact analysis

  • Identify applications or devices that depend on the device code flow.
  • Review the sign-in logs to detect its use.
  • Confirm the block will not affect critical business processes.

In mature environments, this analysis is part of an M365 security audit and a Microsoft Entra ID hardening process aimed at minimising the risks of alternative authentication flows.

How to configure the Block device code sign-in flow Conditional Access policy

To implement Block device code sign-in flow correctly in Microsoft Entra ID, follow these steps:

  • Click New policy.
  • Give it a descriptive name, for example: CA - Block device code sign-in flow.
  • Under Assignments, select All Users.
  • Under Target resources, select All cloud apps.
  • Under Conditions → Authentication flows, set Configure to Yes and tick Device code flow.
  • Under Access controls → Grant, select Block access.
Block device code sign-in flow policy configuration in Microsoft Entra

With this configuration, once the Block device code sign-in flow policy is applied, this authentication method can no longer be used in the organisation, strengthening access control and identity security.

Additional security recommendations

  • Validate the policy in Report-only mode before applying it in production.
  • Review the organisation's sign-ins to check whether any authentications use the device code flow and whether it is actually needed.
  • Exclude emergency accounts (break glass accounts) and applications or users that explicitly require this authentication method.

About the author:
Kevin Maldonado, LinkedIn

Cybersecurity technician at Allbit Solutions, specialising in protecting Microsoft 365 environments and endpoints. He holds Microsoft certifications in identity and security administration (Identity and Access Administrator Associate, 2025; Azure Security Engineer Associate, 2024), among other credentials.

Shall we talk about your Microsoft environment?

Talk to a specialist →