Commands › Exchange Online

Set-ComplianceSecurityFilter

Exchange Online ExchangeOnlineManagement Set-*

This cmdlet is functional only in Security & Compliance PowerShell. For more information, see Security & Compliance PowerShell. Use the Set-ComplianceSecurityFilter cmdlet to modify compliance security filters in the Microsoft Purview compliance portal.

Quick start script

# Set-ComplianceSecurityFilter — quick start (serv365.ai)
# 1. Connect (app-only shown; interactive: omit the certificate parameters)
Connect-ExchangeOnline -CertificateThumbprint $thumb -AppId $appId -Organization $org

# 2. Capture the current state first — you cannot roll back what you never recorded
$before = Get-ComplianceSecurityFilter
$before | Format-List

# 3. Make the change (dry run first)
Set-ComplianceSecurityFilter -FilterName <String> -WhatIf
Set-ComplianceSecurityFilter -FilterName <String>

# 4. Verify and diff
$after = Get-ComplianceSecurityFilter
Compare-Object ($before | Out-String) ($after | Out-String)

Syntax

Set-ComplianceSecurityFilter -FilterName <String>
 [-Action <ComplianceSecurityFilterActionType>]
 [-Confirm]
 [-Description <String>]
 [-Filters <MultiValuedProperty>]
 [-Region <String>]
 [-Users <MultiValuedProperty>]
 [-WhatIf]
 [<CommonParameters>]

Parameters (8)

ParameterTypeRequiredWhat it controls
-FilterName String yes The FilterName parameter specifies the name of the compliance security filter that you want to modify. If the value contains spaces, enclose the value in quotation marks (").
-Action ComplianceSecurityFilterActionType The Action parameter specifies that type of search action that the filter is applied to. A valid value for this parameter is All, which means the filter is applied to all search actions.
-Confirm SwitchParameter The Confirm switch specifies whether to show or hide the confirmation prompt. How this switch affects the cmdlet depends on whether the cmdlet requires confirmation before proceeding.
-Description String The Description parameter specifies a description for the compliance security filter. The maximum length is 256 characters. If the value contains spaces, enclose the value in quotation marks (").
-Filters MultiValuedProperty The Filters parameter specifies the search criteria for the compliance security filter. You can create three different types of filters:
-Region String The Region parameter specifies the satellite location for multi-geo tenants to conduct eDiscovery searches in. Valid values are:
-Users MultiValuedProperty The Users parameter specifies the user who gets this filter applied to their searches. Valid values are:
-WhatIf SwitchParameter The WhatIf switch doesn't work in Security & Compliance PowerShell.

Reference facts derived from Microsoft documentation, © Microsoft, licensed CC BY 4.0; restructured with original guidance by serv365.ai.