logo
search
Conditional Access Problems

How to Configure a Conditional Access Device Filter with PowerShell

Emma BrownEmma Brown Oct 22, 2026 868 views

Question details

The user needs to configure the 'Filter for devices' condition in an Azure Conditional Access policy using PowerShell, but the necessary property is not visibly exposed in the standard output.

How to Configure a Conditional Access Device Filter with PowerShell
Product
Azure Active Directory
Device & OS
not provided
Scenario
Automating or managing Conditional Access policy deployments via PowerShell scripts.
Observed behavior
The AzureAD PowerShell output does not expose an obvious property or parameter for configuring the 'Filter for devices' condition, making it difficult to script the policy.
Before you start

Verify that you have administrative privileges in your Azure Active Directory tenant and check if you are using the legacy AzureAD module or the newer Microsoft Graph PowerShell SDK.

Solution 1Recommended

Utilize the Microsoft Graph PowerShell SDK

Since the legacy AzureAD module is being deprecated and may lack newer properties, using the Microsoft Graph PowerShell SDK is the recommended way to interact with Conditional Access device filters.

Microsoft is continually updating its enterprise access tools. Features like device filtering in Conditional Access policies are fully supported via the Microsoft Graph API, whereas older AzureAD cmdlets may not expose them directly.

1
Install the Microsoft Graph module

Open your PowerShell console as an Administrator and run 'Install-Module Microsoft.Graph.Identity.SignIns' to get the necessary cmdlets for access policies.

2
Connect to Microsoft Graph

Authenticate by running 'Connect-MgGraph -Scopes "Policy.ReadWrite.ConditionalAccess"' and signing in with your Azure AD administrator credentials.

3
Configure the Device Filter property

Locate the 'Conditions.Devices.Filter' property within your policy object. You can define your rule here, for example: $conditions.devices.filter.rule = "device.operatingSystem eq 'Windows'".

4
Update the Conditional Access Policy

Apply your changes by running 'Update-MgIdentityConditionalAccessPolicy -ConditionalAccessPolicyId <YourPolicyID> -Conditions $conditions'.

Utilize the Microsoft Graph PowerShell SDK
Migration to Microsoft Graph: Transitioning your scripts to the Microsoft Graph PowerShell SDK ensures long-term compatibility and exposes all modern Conditional Access features.
Free Microsoft Office alternative

Looking for a Hassle-Free Office Suite? Try WPS Office

While configuring complex Azure AD policies requires specialized admin tools, your everyday document tasks shouldn't be complicated. WPS Office provides a free, lightweight, and highly compatible alternative to Microsoft Office for your local and cloud document needs.

  1. 1. Download the installer: Visit the official WPS Office website and click the free download button for your operating system.
  2. 2. Install the application: Run the downloaded setup file and follow the straightforward on-screen instructions.
  3. 3. Open and edit your files: Launch WPS Office and immediately start opening, editing, and saving your existing Microsoft Office documents without any formatting loss.
100% compatible with Microsoft Word, Excel, and PowerPoint formats.Lightweight installation with zero complex admin configurations required.Built-in PDF editing, conversion, and cloud collaboration tools.Familiar user interface for a seamless transition from Microsoft Office.
microsoft office alternative - wps office

Frequently Asked Questions

Why can't I find the device filter property in the standard AzureAD PowerShell module?

The legacy AzureAD PowerShell module is being deprecated and does not receive updates for all modern features. Newer features, like specific Conditional Access device filters, are typically exposed through the Microsoft Graph API.

Where is the best place to get help with Azure Active Directory policies?

The official Microsoft Q&A community is the best platform. Because Conditional Access is an enterprise-level feature, posting in the dedicated Azure Active Directory tags ensures your question is seen by specialized cloud administrators.

Do I need special permissions to configure Conditional Access via PowerShell?

Yes. You must be assigned the Conditional Access Administrator, Security Administrator, or Global Administrator role in your Azure AD tenant, and your PowerShell session must be granted the 'Policy.ReadWrite.ConditionalAccess' scope.