From 61c6ba89c80e40dfbee2d14cccb22e084162d36a Mon Sep 17 00:00:00 2001 From: nikcharlebois Date: Wed, 22 Dec 2021 07:15:25 -0500 Subject: [PATCH] Fixes #1018 --- CHANGELOG.md | 3 +++ .../MSFT_EXOAntiPhishPolicy.psm1 | 20 +++++++++++++++++-- .../1-ConfigureAntiPhishPolicy.ps1 | 5 ----- ...crosoft365DSC.EXOAntiPhishPolicy.Tests.ps1 | 8 -------- 4 files changed, 21 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 78825ae2b3..b5869e7ad8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ # 1.21.1222.1 +* EXOAntiPhishPolicy + * Deprecated the EnableAntispoofEnforcement and TargetDomainProtectionAction parameters; + FIXES #1018 * EXOHostedCOntentFilterPolicy * Fix for the MakeDefault property where it wasn't properly setting existing policies to default. diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOAntiPhishPolicy/MSFT_EXOAntiPhishPolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOAntiPhishPolicy/MSFT_EXOAntiPhishPolicy.psm1 index b686556238..7ceb7fcee5 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOAntiPhishPolicy/MSFT_EXOAntiPhishPolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOAntiPhishPolicy/MSFT_EXOAntiPhishPolicy.psm1 @@ -21,6 +21,7 @@ function Get-TargetResource [System.Boolean] $Enabled = $true, + # Deprecated [Parameter()] [System.Boolean] $EnableAntispoofEnforcement = $true, @@ -113,6 +114,7 @@ function Get-TargetResource [System.String[]] $TargetedDomainActionRecipients = @(), + # Deprecated [Parameter()] [ValidateSet('BccMessage', 'Delete', 'MoveToJmf', 'NoAction', 'Quarantine', 'Redirect')] [System.String] @@ -218,7 +220,6 @@ function Get-TargetResource AuthenticationFailAction = $AntiPhishPolicy.AuthenticationFailAction Enabled = $AntiPhishPolicy.Enabled EnableFirstContactSafetyTips = $AntiPhishPolicy.EnableFirstContactSafetyTips - EnableAntispoofEnforcement = $AntiPhishPolicy.EnableAntispoofEnforcement EnableMailboxIntelligence = $AntiPhishPolicy.EnableMailboxIntelligence EnableMailboxIntelligenceProtection = $AntiPhishPolicy.EnableMailboxIntelligenceProtection EnableOrganizationDomainsProtection = $AntiPhishPolicy.EnableOrganizationDomainsProtection @@ -238,7 +239,6 @@ function Get-TargetResource MakeDefault = $AntiPhishPolicy.IsDefault PhishThresholdLevel = $PhishThresholdLevelValue TargetedDomainActionRecipients = $AntiPhishPolicy.TargetedDomainActionRecipients - TargetedDomainProtectionAction = $AntiPhishPolicy.TargetedDomainProtectionAction TargetedDomainsToProtect = $AntiPhishPolicy.TargetedDomainsToProtect TargetedUserActionRecipients = $AntiPhishPolicy.TargetedUserActionRecipients TargetedUserProtectionAction = $TargetedUserProtectionActionValue @@ -305,6 +305,7 @@ function Set-TargetResource [System.Boolean] $Enabled = $true, + # Deprecated [Parameter()] [System.Boolean] $EnableAntispoofEnforcement = $true, @@ -397,6 +398,7 @@ function Set-TargetResource [System.String[]] $TargetedDomainActionRecipients = @(), + # Deprecated [Parameter()] [ValidateSet('BccMessage', 'Delete', 'MoveToJmf', 'NoAction', 'Quarantine', 'Redirect')] [System.String] @@ -444,6 +446,18 @@ function Set-TargetResource $CertificatePassword ) + if ($EnableAntispoofEnforcement) + { + Write-Verbose -Message "The EnableAntispoofEnforcement parameter is now deprecated." + ` + " It will be removed in the next major release. Please update your configuraton." + } + + if ($TargetedDomainProtectionAction) + { + Write-Verbose -Message "The TargetedDomainProtectionAction parameter is now deprecated." + ` + " It will be removed in the next major release. Please update your configuraton." + } + Write-Verbose -Message "Setting configuration of AntiPhishPolicy for $Identity" #Ensure the proper dependencies are installed in the current environment. @@ -516,6 +530,7 @@ function Test-TargetResource [System.Boolean] $Enabled = $true, + # Deprecated [Parameter()] [System.Boolean] $EnableAntispoofEnforcement = $true, @@ -608,6 +623,7 @@ function Test-TargetResource [System.String[]] $TargetedDomainActionRecipients = @(), + # Deprecated [Parameter()] [ValidateSet('BccMessage', 'Delete', 'MoveToJmf', 'NoAction', 'Quarantine', 'Redirect')] [System.String] diff --git a/Modules/Microsoft365DSC/Examples/Resources/EXOAntiPhishPolicy/1-ConfigureAntiPhishPolicy.ps1 b/Modules/Microsoft365DSC/Examples/Resources/EXOAntiPhishPolicy/1-ConfigureAntiPhishPolicy.ps1 index a4fb3c56c1..dc9d6da65a 100644 --- a/Modules/Microsoft365DSC/Examples/Resources/EXOAntiPhishPolicy/1-ConfigureAntiPhishPolicy.ps1 +++ b/Modules/Microsoft365DSC/Examples/Resources/EXOAntiPhishPolicy/1-ConfigureAntiPhishPolicy.ps1 @@ -20,27 +20,22 @@ Configuration Example MakeDefault = $null PhishThresholdLevel = 1 EnableTargetedDomainsProtection = $null - TreatSoftPassAsAuthenticated = $True Enabled = $null TargetedDomainsToProtect = $null EnableSimilarUsersSafetyTips = $null ExcludedDomains = $null - EnableAuthenticationSafetyTip = $False TargetedDomainActionRecipients = $null EnableMailboxIntelligence = $null EnableSimilarDomainsSafetyTips = $null - TargetedDomainProtectionAction = "NoAction" AdminDisplayName = "" AuthenticationFailAction = "MoveToJmf" TargetedUserProtectionAction = "NoAction" TargetedUsersToProtect = $null EnableTargetedUserProtection = $null ExcludedSenders = $null - EnableAuthenticationSoftPassSafetyTip = $False EnableOrganizationDomainsProtection = $null EnableUnusualCharactersSafetyTips = $null TargetedUserActionRecipients = $null - EnableAntispoofEnforcement = $True Ensure = "Present" Credential = $credsGlobalAdmin } diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOAntiPhishPolicy.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOAntiPhishPolicy.Tests.ps1 index 9453051453..9fb61761dc 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOAntiPhishPolicy.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOAntiPhishPolicy.Tests.ps1 @@ -112,7 +112,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { AdminDisplayName = 'DSC Test Policy' Enabled = $true EnableFirstContactSafetyTips = $false - EnableAntispoofEnforcement = $true EnableMailboxIntelligence = $true EnableOrganizationDomainsProtection = $false EnableSimilarDomainsSafetyTips = $false @@ -123,7 +122,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { EnableViaTag = $false MakeDefault = $false AuthenticationFailAction = 'Quarantine' - TargetedDomainProtectionAction = 'BccMessage' TargetedDomainActionRecipients = @('test@contoso.com', 'test@fabrikam.com') TargetedUserProtectionAction = 'BccMessage' TargetedUserActionRecipients = @('test@contoso.com', 'test@fabrikam.com') @@ -139,7 +137,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { AdminDisplayName = 'DSC Test Policy' Enabled = $true EnableFirstContactSafetyTips = $false - EnableAntispoofEnforcement = $true EnableAuthenticationSafetyTip = $true EnableMailboxIntelligence = $true EnableOrganizationDomainsProtection = $false @@ -152,7 +149,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { IsDefault = $false TreatSoftPassAsAuthenticated = $true AuthenticationFailAction = 'Quarantine' - TargetedDomainProtectionAction = 'BccMessage' TargetedDomainActionRecipients = @('test@contoso.com', 'test@fabrikam.com') TargetedUserProtectionAction = 'BccMessage' TargetedUserActionRecipients = @('test@contoso.com', 'test@fabrikam.com') @@ -177,7 +173,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { AdminDisplayName = 'DSC Test Policy' Enabled = $true EnableFirstContactSafetyTips = $false - EnableAntispoofEnforcement = $true EnableMailboxIntelligence = $true EnableOrganizationDomainsProtection = $false EnableSimilarDomainsSafetyTips = $false @@ -188,7 +183,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { EnableViaTag = $false MakeDefault = $false AuthenticationFailAction = 'Quarantine' - TargetedDomainProtectionAction = 'BccMessage' TargetedDomainActionRecipients = @('test@contoso.com', 'test@fabrikam.com') TargetedUserProtectionAction = 'BccMessage' TargetedUserActionRecipients = @('test@contoso.com', 'test@fabrikam.com') @@ -203,7 +197,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { AdminDisplayName = 'DSC Test Policy' Enabled = $false EnableFirstContactSafetyTips = $true - EnableAntispoofEnforcement = $false EnableMailboxIntelligence = $false EnableOrganizationDomainsProtection = $true EnableSimilarDomainsSafetyTips = $true @@ -214,7 +207,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { EnableViaTag = $true MakeDefault = $true AuthenticationFailAction = 'MoveToJmf' - TargetedDomainProtectionAction = 'NoAction' TargetedDomainActionRecipients = @() TargetedUserProtectionAction = 'NoAction' TargetedUserActionRecipients = @()