Commands › Exchange Online

Set-HostedConnectionFilterPolicy

Exchange Online ExchangeOnlineManagement Set-*

Modify the settings of connection filter policies in your cloud-based organization.

Quick start script

# Set-HostedConnectionFilterPolicy — 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-HostedConnectionFilterPolicy
$before | Format-List

# 3. Make the change (dry run first)
Set-HostedConnectionFilterPolicy -Identity <HostedConnectionFilterPolicyIdParameter> -WhatIf
Set-HostedConnectionFilterPolicy -Identity <HostedConnectionFilterPolicyIdParameter>

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

Syntax

Set-HostedConnectionFilterPolicy [-Identity] <HostedConnectionFilterPolicyIdParameter>
 [-AdminDisplayName <String>]
 [-ConfigurationXmlRaw <String>]
 [-Confirm]
 [-EnableSafeList <Boolean>]
 [-IPAllowList <MultiValuedProperty>]
 [-IPBlockList <MultiValuedProperty>]
 [-MakeDefault]
 [-WhatIf]
 [<CommonParameters>]

Parameters (9)

ParameterTypeRequiredWhat it controls
-Identity HostedConnectionFilterPolicyIdParameter yes The Identity parameter specifies the connection filter policy that you want to modify. You can use any value that uniquely identifies the policy. For example:
-AdminDisplayName String The AdminDisplayName parameter specifies a description for the policy. If the value contains spaces, enclose the value in quotation marks ("). The maximum length is 255 characters.
-ConfigurationXmlRaw String This parameter is reserved for internal Microsoft use.
-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.
-EnableSafeList Boolean This parameter is reserved for internal Microsoft use.
-IPAllowList MultiValuedProperty The IPAllowList parameter specifies IP addresses from which messages are always allowed. Messages from the IP addresses you specify aren't identified as spam, despite any other spam characteristics of the messages....
-IPBlockList MultiValuedProperty The IPBlockList parameter specifies IP addresses from which messages are never allowed. Messages from the IP addresses you specify are blocked without any further spam scanning. Valid values are:
-MakeDefault SwitchParameter This parameter is reserved for internal Microsoft use.
-WhatIf SwitchParameter The WhatIf switch shows what the command does without making any changes. You don't need to specify a value with this switch.

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