UCPrimer
  • UCprimer
  • About

Blocking Device Code Flow for Teams Room Android Environments

8/28/2025

0 Comments

 
Picture
In today’s identity-first security landscape, organizations must continuously evaluate and tighten their authentication methods. One such method under scrutiny is device code flow (DCF), a legacy authentication flow that, while useful in certain scenarios, can pose security risks if left unchecked. At the same time, disabling DCF tenant wide can be inconvenient for organizations who have deployed Teams Room on Android devices (MTRA) as DCF presents a convenient method of signing in to Teams on these devices, while also allowing for remote provisioning. Fortunately, Microsoft Entra provides a powerful way to manage and restrict this flow using Conditional Access policies while excluding MTRA devices from this restriction. In this blogpost, we walk through the steps on how to secure legacy login methods while allowing MTRA devices to continue to enjoy the capabilities of DCF.
What is Device Code Flow—and Why Block It?
Device code flow is an OAuth 2.0 authentication method designed for devices with limited input capabilities (e.g., smart TVs or CLI tools). While it enables sign-in without a browser, it lacks modern security protections like phishing-resistant MFA and device compliance checks.
Microsoft recommends blocking or restricting device code flow wherever possible to bolster your security posture. If your organization doesn’t rely on this flow, it’s best to disable it entirely. At the same time, DCF allows for Teams Room on Android devices to be provisioned remotely as well as an simple method for signing into Teams on these devices. For MTRA devices the DCF login screen below should be a familiar scene:
Picture
What we want to achieve in this blogpost is to secure DCF from the rest of the organization while still allowing Teams Room Android devices to leverage DCF for sign-in and remote provisioning. To begin, we first want to create a security group to contain all the MTRA devices in the tenant. We can obviously create a security group in Azure AD and manually add all the devices, but a better method would be to use an Azure AD dynamic security group that will always be updated with newly added or removed over time. In the EntraID admin center, we go to Entra ID -> Manage -> Groups ->New Group window, we select the "Security" Group type, give the Group a name and description, and select "Dynamic Device" for Membership Type as shown below:
Picture
Next we need to click on "Edit dynamic query" to specify the attributes of the group that will match the MTRA devices deployed in the tenant. In the example below, the attributes matching the HP Poly family of Gen1 and Gen2 Teams Room Android devices are specified:
Picture
The Rule Syntax is as follows:

(device.deviceManufacturer -eq "Poly") and (device.deviceModel -in ["PolyStudioG62","PolyStudioX72","PolyStudioX52","PolyStudioX32","PolyStudioX70","PolyStudioX50","PolyStudioX30","PolyG7500","PolyTC10","PolyTC8"])

To verify that the attributes are properly matched, we can go to the newly created group and click on Manage -> Members and there should be a list of devices that are shown (assuming) that there are actually HP Poly MTRA devices deployed in the tenant:
Picture
The next step is to create a Conditional Access policy in inTune/MEM portal and navigate to Devices -> Manage Devices -> Conditional Access and then click on "Create new policy:
Picture
We give the new policy a name, then under Assignments, select Users or workload identities.Under Include, select the users you want to be in-scope for the policy (all users recommended). Under Exclude: Select Users and groups and choose the newly created dynamic group. Note that this exclusion list should be audited regularly to make sure it only contains the MTRA devices. 
Picture
Under Target resources > Resources -> Include select All resources, Under Conditions > Authentication Flows, set Configure to Yes.
Select Device code flow then Select Done.Under Access controls > Grant, select Block access and Select Select. Confirm your settings and set Enable policy to Report-only. Finally Select Create to create to enable your policy.
Picture
And now the policy is created. DCF login will be blocked for all users except for Teams Room Android devices from HP Poly. Before enforcing the block, we use Report-only mode to monitor how the policy would affect users. This helps identify dependencies and avoid disruptions.

Conclusion
Blocking legacy authentication flows like device code flow is a proactive step toward a zero trust security model. With Microsoft Entra’s Conditional Access, you gain granular control over how users authenticate, ensuring only secure, compliant methods are used.
If you're not already auditing or restricting device code flow, now is the time to start.
0 Comments

Your comment will be posted after it is approved.


Leave a Reply.

    UCPrimer

    Picture
    Picture
    Picture
    View my profile on LinkedIn

    Important Links

    Microsoft Teams Docs
    Microsoft Learn

    Archives

    October 2025
    September 2025
    August 2025
    June 2025
    April 2025
    March 2025
    February 2025
    January 2025
    December 2024
    November 2024
    October 2024
    August 2024
    July 2024
    May 2024
    April 2024
    March 2024
    February 2024
    December 2023
    November 2023
    October 2023
    September 2023
    July 2023
    March 2023
    February 2023
    January 2023
    November 2022
    October 2022
    September 2022
    August 2022
    July 2022
    March 2022
    February 2022
    January 2022
    December 2021
    November 2021
    October 2021
    September 2021
    August 2021
    June 2021
    April 2021
    March 2021
    December 2020
    October 2020
    September 2020
    August 2020
    April 2020
    March 2020
    February 2020
    January 2020
    December 2019
    November 2019
    October 2019
    September 2019
    August 2019
    July 2019
    March 2019
    November 2018
    October 2018
    September 2018
    August 2018
    June 2018
    March 2018
    February 2018
    January 2018
    December 2017
    November 2017
    August 2017
    July 2017
    April 2017
    March 2017
    February 2017
    January 2017
    November 2016
    October 2016
    September 2016
    August 2016
    July 2016
    June 2016
    May 2016
    April 2016
    March 2016
    January 2016
    November 2015
    October 2015
    September 2015
    August 2015
    July 2015
    June 2015
    May 2015
    April 2015
    March 2015
    February 2015
    January 2015
    December 2014
    November 2014
    October 2014
    September 2014
    August 2014
    July 2014
    June 2014
    May 2014
    April 2014
    March 2014
    February 2014
    January 2014
    December 2013
    November 2013
    October 2013
    September 2013
    August 2013
    July 2013
    June 2013
    May 2013
    April 2013
    March 2013
    February 2013
    January 2013
    December 2012
    November 2012
    September 2012
    August 2012

    Categories

    All
    Edge
    Exchange 2013
    Hybrid
    Lpe
    Lync 2010
    Lync 2013
    Mobility
    Oauth
    Office365
    Polycom
    Ucs

    RSS Feed

    This website uses marketing and tracking technologies. Opting out of this will opt you out of all cookies, except for those needed to run the website. Note that some products may not work as well without tracking cookies.

    Opt Out of Cookies