Commands › Exchange Online
Set-ATPBuiltInProtectionRule
Modify the rule for the Built-in protection preset security policy that effectively provides default policies for Safe Links and Safe Attachments in Microsoft Defender for Office 365. The rule specifies exceptions to the policy.
Quick start script
# Set-ATPBuiltInProtectionRule — 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-ATPBuiltInProtectionRule
$before | Format-List
# 3. Make the change (dry run first)
Set-ATPBuiltInProtectionRule -Identity <DehydrateableRuleIdParameter> -WhatIf
Set-ATPBuiltInProtectionRule -Identity <DehydrateableRuleIdParameter>
# 4. Verify and diff
$after = Get-ATPBuiltInProtectionRule
Compare-Object ($before | Out-String) ($after | Out-String)
Syntax
Set-ATPBuiltInProtectionRule [-Identity] <DehydrateableRuleIdParameter>
[-Comments <String>]
[-Confirm]
[-ExceptIfRecipientDomainIs <Word[]>]
[-ExceptIfSentTo <RecipientIdParameter[]>]
[-ExceptIfSentToMemberOf <RecipientIdParameter[]>]
[-WhatIf]
[<CommonParameters>]
Parameters (7)
Reference facts derived from Microsoft documentation, © Microsoft, licensed CC BY 4.0; restructured with original guidance by serv365.ai.