How to Configure a Conditional Access Device Filter with PowerShell
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.

- 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.
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.
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.
Open your PowerShell console as an Administrator and run 'Install-Module Microsoft.Graph.Identity.SignIns' to get the necessary cmdlets for access policies.
Authenticate by running 'Connect-MgGraph -Scopes "Policy.ReadWrite.ConditionalAccess"' and signing in with your Azure AD administrator credentials.
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'".
Apply your changes by running 'Update-MgIdentityConditionalAccessPolicy -ConditionalAccessPolicyId <YourPolicyID> -Conditions $conditions'.

Seek Support in the Azure AD Q&A Community
If you encounter specific tenant restrictions or undocumented module behaviors, consulting the official Microsoft Azure community is the best course of action.
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. Download the installer: Visit the official WPS Office website and click the free download button for your operating system.
- 2. Install the application: Run the downloaded setup file and follow the straightforward on-screen instructions.
- 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.

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.




