@@ -51,6 +51,11 @@ function Invoke-CIPPStandardAntiPhishPolicy {
5151 param ($Tenant , $Settings )
5252 # #$Rerun -Type Standard -Tenant $Tenant -Settings $Settings 'AntiPhishPolicy'
5353
54+ $ServicePlans = New-GraphGetRequest - uri ' https://graph.microsoft.com/beta/subscribedSkus?$select=servicePlans' - tenantid $Tenant
55+ $ServicePlans = $ServicePlans.servicePlans.servicePlanName
56+ $MDOLicensed = $ServicePlans -contains " ATP_ENTERPRISE"
57+ Write-Information " MDOLicensed: $MDOLicensed "
58+
5459 $PolicyList = @ (' CIPP Default Anti-Phishing Policy' , ' Default Anti-Phishing Policy' )
5560 $ExistingPolicy = New-ExoRequest - tenantid $Tenant - cmdlet ' Get-AntiPhishPolicy' | Where-Object - Property Name -In $PolicyList
5661 if ($null -eq $ExistingPolicy.Name ) {
@@ -69,27 +74,38 @@ function Invoke-CIPPStandardAntiPhishPolicy {
6974 $CurrentState = $ExistingPolicy |
7075 Select-Object Name, Enabled, PhishThresholdLevel, EnableMailboxIntelligence, EnableMailboxIntelligenceProtection, EnableSpoofIntelligence, EnableFirstContactSafetyTips, EnableSimilarUsersSafetyTips, EnableSimilarDomainsSafetyTips, EnableUnusualCharactersSafetyTips, EnableUnauthenticatedSender, EnableViaTag, AuthenticationFailAction, SpoofQuarantineTag, MailboxIntelligenceProtectionAction, MailboxIntelligenceQuarantineTag, TargetedUserProtectionAction, TargetedUserQuarantineTag, TargetedDomainProtectionAction, TargetedDomainQuarantineTag, EnableOrganizationDomainsProtection
7176
72- $StateIsCorrect = ($CurrentState.Name -eq $PolicyName ) -and
73- ($CurrentState.Enabled -eq $true ) -and
74- ($CurrentState.PhishThresholdLevel -eq $Settings.PhishThresholdLevel ) -and
75- ($CurrentState.EnableMailboxIntelligence -eq $true ) -and
76- ($CurrentState.EnableMailboxIntelligenceProtection -eq $true ) -and
77- ($CurrentState.EnableSpoofIntelligence -eq $true ) -and
78- ($CurrentState.EnableFirstContactSafetyTips -eq $Settings.EnableFirstContactSafetyTips ) -and
79- ($CurrentState.EnableSimilarUsersSafetyTips -eq $Settings.EnableSimilarUsersSafetyTips ) -and
80- ($CurrentState.EnableSimilarDomainsSafetyTips -eq $Settings.EnableSimilarDomainsSafetyTips ) -and
81- ($CurrentState.EnableUnusualCharactersSafetyTips -eq $Settings.EnableUnusualCharactersSafetyTips ) -and
82- ($CurrentState.EnableUnauthenticatedSender -eq $true ) -and
83- ($CurrentState.EnableViaTag -eq $true ) -and
84- ($CurrentState.AuthenticationFailAction -eq $Settings.AuthenticationFailAction ) -and
85- ($CurrentState.SpoofQuarantineTag -eq $Settings.SpoofQuarantineTag ) -and
86- ($CurrentState.MailboxIntelligenceProtectionAction -eq $Settings.MailboxIntelligenceProtectionAction ) -and
87- ($CurrentState.MailboxIntelligenceQuarantineTag -eq $Settings.MailboxIntelligenceQuarantineTag ) -and
88- ($CurrentState.TargetedUserProtectionAction -eq $Settings.TargetedUserProtectionAction ) -and
89- ($CurrentState.TargetedUserQuarantineTag -eq $Settings.TargetedUserQuarantineTag ) -and
90- ($CurrentState.TargetedDomainProtectionAction -eq $Settings.TargetedDomainProtectionAction ) -and
91- ($CurrentState.TargetedDomainQuarantineTag -eq $Settings.TargetedDomainQuarantineTag ) -and
92- ($CurrentState.EnableOrganizationDomainsProtection -eq $true )
77+ if ($MDOLicensed ) {
78+ $StateIsCorrect = ($CurrentState.Name -eq $PolicyName ) -and
79+ ($CurrentState.Enabled -eq $true ) -and
80+ ($CurrentState.PhishThresholdLevel -eq $Settings.PhishThresholdLevel ) -and
81+ ($CurrentState.EnableMailboxIntelligence -eq $true ) -and
82+ ($CurrentState.EnableMailboxIntelligenceProtection -eq $true ) -and
83+ ($CurrentState.EnableSpoofIntelligence -eq $true ) -and
84+ ($CurrentState.EnableFirstContactSafetyTips -eq $Settings.EnableFirstContactSafetyTips ) -and
85+ ($CurrentState.EnableSimilarUsersSafetyTips -eq $Settings.EnableSimilarUsersSafetyTips ) -and
86+ ($CurrentState.EnableSimilarDomainsSafetyTips -eq $Settings.EnableSimilarDomainsSafetyTips ) -and
87+ ($CurrentState.EnableUnusualCharactersSafetyTips -eq $Settings.EnableUnusualCharactersSafetyTips ) -and
88+ ($CurrentState.EnableUnauthenticatedSender -eq $true ) -and
89+ ($CurrentState.EnableViaTag -eq $true ) -and
90+ ($CurrentState.AuthenticationFailAction -eq $Settings.AuthenticationFailAction ) -and
91+ ($CurrentState.SpoofQuarantineTag -eq $Settings.SpoofQuarantineTag ) -and
92+ ($CurrentState.MailboxIntelligenceProtectionAction -eq $Settings.MailboxIntelligenceProtectionAction ) -and
93+ ($CurrentState.MailboxIntelligenceQuarantineTag -eq $Settings.MailboxIntelligenceQuarantineTag ) -and
94+ ($CurrentState.TargetedUserProtectionAction -eq $Settings.TargetedUserProtectionAction ) -and
95+ ($CurrentState.TargetedUserQuarantineTag -eq $Settings.TargetedUserQuarantineTag ) -and
96+ ($CurrentState.TargetedDomainProtectionAction -eq $Settings.TargetedDomainProtectionAction ) -and
97+ ($CurrentState.TargetedDomainQuarantineTag -eq $Settings.TargetedDomainQuarantineTag ) -and
98+ ($CurrentState.EnableOrganizationDomainsProtection -eq $true )
99+ } else {
100+ $StateIsCorrect = ($CurrentState.Name -eq $PolicyName ) -and
101+ ($CurrentState.Enabled -eq $true ) -and
102+ ($CurrentState.EnableSpoofIntelligence -eq $true ) -and
103+ ($CurrentState.EnableFirstContactSafetyTips -eq $Settings.EnableFirstContactSafetyTips ) -and
104+ ($CurrentState.EnableUnauthenticatedSender -eq $true ) -and
105+ ($CurrentState.EnableViaTag -eq $true ) -and
106+ ($CurrentState.AuthenticationFailAction -eq $Settings.AuthenticationFailAction ) -and
107+ ($CurrentState.SpoofQuarantineTag -eq $Settings.SpoofQuarantineTag )
108+ }
93109
94110 $AcceptedDomains = New-ExoRequest - tenantid $Tenant - cmdlet ' Get-AcceptedDomain'
95111
@@ -106,27 +122,39 @@ function Invoke-CIPPStandardAntiPhishPolicy {
106122 if ($StateIsCorrect -eq $true ) {
107123 Write-LogMessage - API ' Standards' - tenant $Tenant - message ' Anti-phishing policy already correctly configured' - sev Info
108124 } else {
109- $cmdparams = @ {
110- Enabled = $true
111- PhishThresholdLevel = $Settings.PhishThresholdLevel
112- EnableMailboxIntelligence = $true
113- EnableMailboxIntelligenceProtection = $true
114- EnableSpoofIntelligence = $true
115- EnableFirstContactSafetyTips = $Settings.EnableFirstContactSafetyTips
116- EnableSimilarUsersSafetyTips = $Settings.EnableSimilarUsersSafetyTips
117- EnableSimilarDomainsSafetyTips = $Settings.EnableSimilarDomainsSafetyTips
118- EnableUnusualCharactersSafetyTips = $Settings.EnableUnusualCharactersSafetyTips
119- EnableUnauthenticatedSender = $true
120- EnableViaTag = $true
121- AuthenticationFailAction = $Settings.AuthenticationFailAction
122- SpoofQuarantineTag = $Settings.SpoofQuarantineTag
123- MailboxIntelligenceProtectionAction = $Settings.MailboxIntelligenceProtectionAction
124- MailboxIntelligenceQuarantineTag = $Settings.MailboxIntelligenceQuarantineTag
125- TargetedUserProtectionAction = $Settings.TargetedUserProtectionAction
126- TargetedUserQuarantineTag = $Settings.TargetedUserQuarantineTag
127- TargetedDomainProtectionAction = $Settings.TargetedDomainProtectionAction
128- TargetedDomainQuarantineTag = $Settings.TargetedDomainQuarantineTag
129- EnableOrganizationDomainsProtection = $true
125+ if ($MDOLicensed ) {
126+ $cmdparams = @ {
127+ Enabled = $true
128+ PhishThresholdLevel = $Settings.PhishThresholdLevel
129+ EnableMailboxIntelligence = $true
130+ EnableMailboxIntelligenceProtection = $true
131+ EnableSpoofIntelligence = $true
132+ EnableFirstContactSafetyTips = $Settings.EnableFirstContactSafetyTips
133+ EnableSimilarUsersSafetyTips = $Settings.EnableSimilarUsersSafetyTips
134+ EnableSimilarDomainsSafetyTips = $Settings.EnableSimilarDomainsSafetyTips
135+ EnableUnusualCharactersSafetyTips = $Settings.EnableUnusualCharactersSafetyTips
136+ EnableUnauthenticatedSender = $true
137+ EnableViaTag = $true
138+ AuthenticationFailAction = $Settings.AuthenticationFailAction
139+ SpoofQuarantineTag = $Settings.SpoofQuarantineTag
140+ MailboxIntelligenceProtectionAction = $Settings.MailboxIntelligenceProtectionAction
141+ MailboxIntelligenceQuarantineTag = $Settings.MailboxIntelligenceQuarantineTag
142+ TargetedUserProtectionAction = $Settings.TargetedUserProtectionAction
143+ TargetedUserQuarantineTag = $Settings.TargetedUserQuarantineTag
144+ TargetedDomainProtectionAction = $Settings.TargetedDomainProtectionAction
145+ TargetedDomainQuarantineTag = $Settings.TargetedDomainQuarantineTag
146+ EnableOrganizationDomainsProtection = $true
147+ }
148+ } else {
149+ $cmdparams = @ {
150+ Enabled = $true
151+ EnableSpoofIntelligence = $true
152+ EnableFirstContactSafetyTips = $Settings.EnableFirstContactSafetyTips
153+ EnableUnauthenticatedSender = $true
154+ EnableViaTag = $true
155+ AuthenticationFailAction = $Settings.AuthenticationFailAction
156+ SpoofQuarantineTag = $Settings.SpoofQuarantineTag
157+ }
130158 }
131159
132160 if ($CurrentState.Name -eq $PolicyName ) {
0 commit comments