Authentication flows Protection & Device Registration Service for Intune Enrolment
When I blogged last week about whether it is possible to enrol a device in Intune without ever having to authenticate on the device itself, I wanted to follow it up with additional security measures that organizations may need to consider if they use device code flow for device registration purposes. While Microsoft Entra ID supports a wide range of authentication and authorization flows to provide a seamless experience across all application and device types, device code flow can be misused and exploited to carry out phishing attacks and therefore is considered high-risk. In general, Microsoft recommends blocking it altogether, but that may not always be an option as indicated in the my earlier post. In this post I will cover how to block authentication flow and how device registration can be allowed in certain scenarios.
Authentication flows in a nutshell
To provide more control over your security posture, Microsoft has provided the ability to control certain authentication flows through Conditional Access. This is done through what Microsoft calls as Protocol tracking. The tracking is applied to the session using device code flow or authentication transfer. Protocol tracked sessions are subject to policy enforcement if a policy exists. As of writing this blog, Authentication flows mainly comprises of the following 2 flows -
1. Device Code - This authentication flow is generally used when there is either lack of local input like on shared devices or an alternate authentication is required in presence of ADFS or a 3rd party Identity provider.
2. Authentication Transfer - This authentication flow offers a seamless way of transferring authenticated state from one device to another. It basically means that when a user say is presented with a QR code within the desktop version of Outlook, when scanned on their mobile device, will result in transferring their authenticated state to the mobile device.
How to block authentication flows using Conditional Access policy?
This can be achieved using the new condition called Authentication Flows. Following are the steps -
1. Sign in to the Microsoft Entra admin center.
2. Browse to Protection > Conditional Access > Policies.
3. Select New policy and give a name.
4. Under Assignments, select Users or workload identities.
5. Under Include, select the users you want to be in-scope for the policy (all users recommended) and under Exclude, select users and groups and choose your organization's emergency access or break-glass accounts as necessary.
6. Under Target resources > Resources (formerly cloud apps) > Include, select the apps you want to be in-scope for the policy (All resources (formerly 'All cloud apps' is recommended).
7. Under Conditions > Authentication Flows, set Configure to Yes and select Device code flow as shown below -
8. Under Access controls > Grant, select Block access.
9. Confirm your settings and set Enable policy. Note: Always test the policy in Report-only mode.
End Result
When the user tries to use a device code to authenticate on another device for Intune enrolment, the authentication is blocked.
This is evident in the Entra ID sign-in logs as well.
Now, if an organization wants to still use device code flow for authentication purposes, but also have conditional access policies for authentication flows targeting all resources, then Device Registration Resource app, will need to be excluded from the targeted apps in the policy. Also, the exclusion will only work with Grant action. If you use block, then the authentication flow will get blocked early on before even reaching the Device registration stage. To do this, simply follow the steps below -
1. Sign in to the Microsoft Entra admin center.
2. Browse to Protection > Conditional Access > Policies.
3. Select New policy and give a name.
4. Under Assignments, select Users or workload identities.
5. Under Include, select the users you want to be in-scope for the policy (all users recommended) and under Exclude, select users and groups and choose your organization's emergency access or break-glass accounts as necessary.
6. Under Target resources > Resources (formerly cloud apps) > Include, select the apps you want to be in-scope for the policy (All resources (formerly 'All cloud apps' is recommended) and exclude the Device Registration Service app as shown below -
7. Under Conditions > Authentication Flows, set Configure to Yes and select Device code flow as before.
8. Under Access controls > Grant, select necessary Grant controls.
9. Confirm your settings and set Enable policy. Note: Always test the policy in Report-only mode.
End Result
When the user tries to authenticate using device code on another machine, the sign-in is allowed and the user is able to progress with the Intune enrolment. This is evident from Entra ID sign-in logs. You can filter for Client ID 01cb2876-7ebd-4aa4-9cc9-d28bd4d359a9 to pull the relevant events.
The exclusion of Device Registration Service will pull in the Intune Company Portal app into exemption as well allowing the device registration and enrolment in Intune to complete.
Until next time..
Comments
Post a Comment