🛡️ Microsoft Entra ID Device Code Authentication Flow is not restricted🟢⚪
- Contextual name: 🛡️ Device Code Authentication Flow is not restricted🟢⚪
- ID:
/ce/ca/azure/microsoft-entra-id/device-code-authentication-flow - Tags:
- Policy Type:
COMPLIANCE_POLICY - Policy Categories:
SECURITY
Description
Description
Conditional Access Policies can be used to prevent the device code authentication flow. Device code flow should be permitted only for users who regularly perform duties that explicitly require the use of device code to authenticate, such as using Azure with PowerShell.
Rationale
Attackers use device code flow in phishing attacks and, if successful, can gain access and refresh tokens scoped to
user_impersonation, which can perform any action the user has permission to perform.Impact
Microsoft Entra ID P1 or P2 is required.
This policy should be tested using the
Report-only modebefore implementation. Without a full and careful understanding of the accounts and personnel who require Device code authentication flow, implementing this policy can block authentication for users and devices who rely on Device code flow. For users and devices that rely on device code flow authentication, more secure alternatives should be implemented wherever possible.Audit
From Azure Portal
- In the Azure portal, open the portal menu in the upper left and select
Microsoft Entra ID.... see more
Remediation
Remediation
From Azure Portal
Part 1 of 2 - Create the policy and enable it in
Report-onlymode
- In the Azure portal, open the portal menu in the upper left and select
Microsoft Entra ID.- Scroll down in the menu on the left and select
Security.- On the left, select
Conditional Access.- Select
Policies.- Click the
+ New policybutton, then:- Provide a name for the policy.
- Under
Assignments, selectUsers, then:
- Under
Include, selectAll users.- Under
Exclude, check Users and groups and only select emergency access accounts.- Under
Assignments, selectTarget resources, then:
- Under
Include, selectAll cloud apps.- Leave
Excludeblank unless you have a well-defined exception.- Under
Conditions>Authentication Flows, setConfiguretoYes, then:
- Select
Device code flow.- Select
Done.- Under
Access Controls>Grant, selectBlock Access.- Set
Enable policytoReport-only.- Click
Create.Allow some time to pass to ensure the sign-in logs capture relevant conditional access events. These events will need to be reviewed to determine if additional considerations are necessary for your organization (e.g. many legitimate use cases of device code authentication are observed).
... see more
policy.yaml
Linked Framework Sections
| Section | Sub Sections | Internal Rules | Policies | Flags | Compliance |
|---|---|---|---|---|---|
| 💼 CIS Azure v5.0.0 → 💼 5.2.3 Ensure that an exclusionary device code flow policy is considered (Manual) | 1 | no data | |||
| 💼 Cloudaware Framework → 💼 General Access Controls | 12 | no data |