From 44793e8d90540edbf467b203efa116aaeec60843 Mon Sep 17 00:00:00 2001 From: Nik Charlebois Date: Tue, 30 Jan 2024 16:42:28 -0500 Subject: [PATCH 1/3] Various Fixes for EXO workload --- CHANGELOG.md | 16 ++++++++ .../MSFT_EXOAvailabilityAddressSpace.psm1 | 35 +++++++++++++++--- .../MSFT_EXOAvailabilityConfig.psm1 | 8 +++- .../MSFT_EXODistributionGroup.psm1 | 37 ++++++++++++++++++- .../MSFT_EXOHostedContentFilterPolicy.psm1 | 19 ++++++---- .../MSFT_EXOIntraOrganizationConnector.psm1 | 5 +++ .../MSFT_EXOMalwareFilterRule.psm1 | 7 +++- .../MSFT_EXOMessageClassification.psm1 | 3 +- .../MSFT_EXOOMEConfiguration.psm1 | 2 +- .../MSFT_EXOSafeLinksPolicy.psm1 | 11 ++---- .../EXOHostedContentFilterPolicy/1-Create.ps1 | 4 -- .../EXOHostedContentFilterPolicy/2-Update.ps1 | 4 -- .../EXOHostedContentFilterRule/1-Create.ps1 | 3 +- .../EXOHostedContentFilterRule/2-Update.ps1 | 3 +- .../1-Create.ps1 | 2 +- .../2-Update.ps1 | 2 +- .../Resources/EXOManagementRole/1-Create.ps1 | 3 +- .../Resources/EXOManagementRole/2-Update.ps1 | 3 +- .../EXOOfflineAddressBook/1-Create.ps1 | 2 +- .../EXOOfflineAddressBook/2-Update.ps1 | 2 +- .../Resources/EXORemoteDomain/1-Create.ps1 | 2 +- .../Resources/EXORemoteDomain/2-Update.ps1 | 2 +- .../EXOSafeAttachmentRule/1-Create.ps1 | 5 ++- .../EXOSafeAttachmentRule/2-Update.ps1 | 5 ++- .../Resources/EXOSafeLinksPolicy/1-Create.ps1 | 1 - .../Resources/EXOSafeLinksPolicy/2-Update.ps1 | 1 - .../Resources/EXOSafeLinksRule/1-Create.ps1 | 5 ++- .../Resources/EXOSafeLinksRule/2-Update.ps1 | 5 ++- .../Resources/EXOTransportRule/1-Create.ps1 | 5 ++- .../Resources/EXOTransportRule/2-Update.ps1 | 5 ++- 30 files changed, 147 insertions(+), 60 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a473553ef..0072b6ac1f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,8 +2,24 @@ # UNRELEASED +* EXOAvailabilityAddressSpace + * Added support for the TargetServiceEpr and TargetTenantId parameters. + * Fixed the logic to retrieve existing instance by Forest Name. +* EXODistributionGroup + * The Get function now retrieves the ModeratedBy and ManagedBy properties + by the users' UPN instead of their GUID. * EXOHostedContentFilterRule * Changed logic to retrieve the Rules by name. Using the Policy's name instead. +* EXOIntraOrganizationConnector + * Fixes the DiscoveryEndpoint value from the Get method to include trailing + forward slash. +* EXOMalwareFilterRule + * Fixed an issue retrieving the right value for the Enabled property +* EXOOMEConfiguration + * Fixes an error in the Get method where the ExternalMailExpiryInDays property + wasn't properly returned. +* EXOSafeLinksPolicy + * Deprecated the UseTranslatedNotificationText property * TeamsEmergencyCallRoutingPolicy * Fix deletion of resource FIXES [#4261](https://github.com/microsoft/Microsoft365DSC/issues/4261) diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOAvailabilityAddressSpace/MSFT_EXOAvailabilityAddressSpace.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOAvailabilityAddressSpace/MSFT_EXOAvailabilityAddressSpace.psm1 index 5897eda34b..24224289d7 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOAvailabilityAddressSpace/MSFT_EXOAvailabilityAddressSpace.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOAvailabilityAddressSpace/MSFT_EXOAvailabilityAddressSpace.psm1 @@ -26,6 +26,14 @@ function Get-TargetResource [System.String] $TargetAutodiscoverEpr, + [Parameter()] + [System.String] + $TargetServiceEpr, + + [Parameter()] + [System.String] + $TargetTenantId, + [Parameter()] [ValidateSet('Present', 'Absent')] [System.String] @@ -91,7 +99,7 @@ function Get-TargetResource { try { - $AvailabilityAddressSpaces = Get-AvailabilityAddressSpace -ErrorAction Stop + $AvailabilityAddressSpace = Get-AvailabilityAddressSpace -Identity $ForestName -ErrorAction Stop } catch { @@ -99,17 +107,13 @@ function Get-TargetResource -Exception $_ ` -Source $MyInvocation.MyCommand.ModuleName } - - $AvailabilityAddressSpace = $AvailabilityAddressSpaces | Where-Object -FilterScript { $_.Identity -eq $Identity } if ($null -eq $AvailabilityAddressSpace) { - Write-Verbose -Message "AvailabilityAddressSpace $($Identity) does not exist." + Write-Verbose -Message "AvailabilityAddressSpace $($ForestName) does not exist." return $nullReturn } else { - - if ($Null -eq $AvailabilityAddressSpace.TargetAutodiscoverEpr -or $AvailabilityAddressSpace.TargetAutodiscoverEpr -eq '' ) { $TargetAutodiscoverEpr = '' @@ -123,6 +127,8 @@ function Get-TargetResource Identity = $Identity AccessMethod = $AvailabilityAddressSpace.AccessMethod Credentials = $AvailabilityAddressSpace.Credentials + TargetServiceEpr = $AvailabilityAddressSpace.TargetServiceEpd + TargetTenantId = $AvailabilityAddressSpace.TargetTenantId ForestName = $AvailabilityAddressSpace.ForestName TargetAutodiscoverEpr = $TargetAutodiscoverEpr Credential = $Credential @@ -179,6 +185,14 @@ function Set-TargetResource [System.String] $TargetAutodiscoverEpr, + [Parameter()] + [System.String] + $TargetServiceEpr, + + [Parameter()] + [System.String] + $TargetTenantId, + [Parameter()] [ValidateSet('Present', 'Absent')] [System.String] @@ -339,6 +353,14 @@ function Test-TargetResource [System.String] $TargetAutodiscoverEpr, + [Parameter()] + [System.String] + $TargetServiceEpr, + + [Parameter()] + [System.String] + $TargetTenantId, + [Parameter()] [ValidateSet('Present', 'Absent')] [System.String] @@ -399,6 +421,7 @@ function Test-TargetResource $ValuesToCheck.Remove('CertificatePath') | Out-Null $ValuesToCheck.Remove('CertificatePassword') | Out-Null $ValuesToCheck.Remove('ManagedIdentity') | Out-Null + $ValuesToCheck.Remove('Identity') | Out-Null $TestResult = Test-M365DSCParameterState -CurrentValues $CurrentValues ` -Source $($MyInvocation.MyCommand.Source) ` diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOAvailabilityConfig/MSFT_EXOAvailabilityConfig.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOAvailabilityConfig/MSFT_EXOAvailabilityConfig.psm1 index 9bf80ec4b8..f57970c686 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOAvailabilityConfig/MSFT_EXOAvailabilityConfig.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOAvailabilityConfig/MSFT_EXOAvailabilityConfig.psm1 @@ -54,6 +54,9 @@ function Get-TargetResource -InboundParameters $PSBoundParameters } + $ConnectionMode = New-M365DSCConnection -Workload 'MicrosoftGraph' ` + -InboundParameters $PSBoundParameters + #Ensure the proper dependencies are installed in the current environment. Confirm-M365DSCDependencies @@ -76,7 +79,8 @@ function Get-TargetResource if ($null -ne $AvailabilityConfigs -and $null -ne $AvailabilityConfigs.OrgWideAccount) { - $AvailabilityConfig = ($AvailabilityConfigs | Where-Object -FilterScript { $_.OrgWideAccount -IMatch $OrgWideAccount }) + $user = Get-MgUser -UserId $OrgWideAccount -ErrorAction Stop + $AvailabilityConfig = ($AvailabilityConfigs | Where-Object -FilterScript { $_.OrgWideAccount -IMatch $user.UserId }) } if ($null -eq $AvailabilityConfig) { @@ -84,7 +88,7 @@ function Get-TargetResource return $nullReturn } $result = @{ - OrgWideAccount = $AvailabilityConfig.OrgWideAccount + OrgWideAccount = $OrgWideAccount Ensure = 'Present' Credential = $Credential ApplicationId = $ApplicationId diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXODistributionGroup/MSFT_EXODistributionGroup.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXODistributionGroup/MSFT_EXODistributionGroup.psm1 index 52a5afcf6d..f5add5b03b 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXODistributionGroup/MSFT_EXODistributionGroup.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXODistributionGroup/MSFT_EXODistributionGroup.psm1 @@ -300,6 +300,39 @@ function Get-TargetResource $groupTypeValue = 'Security' } + $ManagedByValue = @() + if ($null -ne $distributionGroup.ManagedBy) + { + foreach ($user in $distributionGroup.ManagedBy) + { + try + { + $user = Get-MgUser -UserId $user -ErrorAction Stop + $ManagedByValue += $user.UserPrincipalName + } + catch + { + Write-Verbose -Message "Couldn't retrieve user {$user}" + } + } + } + + $ModeratedByValue = @() + if ($null -ne $distributionGroup.ModeratedBy) + { + foreach ($user in $distributionGroup.ModeratedBy) + { + try + { + $user = Get-MgUser -UserId $user -ErrorAction Stop + $ModeratedByValue += $user.UserPrincipalName + } + catch + { + Write-Verbose -Message "Couldn't retrieve moderating user {$user}" + } + } + } $result = @{ Identity = $distributionGroup.Identity Alias = $distributionGroup.Alias @@ -308,11 +341,11 @@ function Get-TargetResource Description = $descriptionValue DisplayName = $distributionGroup.DisplayName HiddenGroupMembershipEnabled = $distributionGroup.HiddenGroupMembershipEnabled - ManagedBy = $distributionGroup.ManagedBy + ManagedBy = $ManagedByValue MemberDepartRestriction = $distributionGroup.MemberDepartRestriction MemberJoinRestriction = $distributionGroup.MemberJoinRestriction Members = $distributionGroupMembers.Name - ModeratedBy = $distributionGroup.ModeratedBy + ModeratedBy = $ModeratedByValue ModerationEnabled = $distributionGroup.ModerationEnabled Name = $distributionGroup.Name Notes = $distributionGroup.Notes diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOHostedContentFilterPolicy/MSFT_EXOHostedContentFilterPolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOHostedContentFilterPolicy/MSFT_EXOHostedContentFilterPolicy.psm1 index 7c98904f0a..1cf252701b 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOHostedContentFilterPolicy/MSFT_EXOHostedContentFilterPolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOHostedContentFilterPolicy/MSFT_EXOHostedContentFilterPolicy.psm1 @@ -50,6 +50,7 @@ function Get-TargetResource [System.Boolean] $DownloadLink = $false, + #DEPRECATED [Parameter()] [System.Boolean] $EnableEndUserSpamNotifications = $false, @@ -302,9 +303,7 @@ function Get-TargetResource $nullReturn.Ensure = 'Absent' try { - $HostedContentFilterPolicies = Get-HostedContentFilterPolicy -ErrorAction Stop - - $HostedContentFilterPolicy = $HostedContentFilterPolicies | Where-Object -FilterScript { $_.Identity -eq $Identity } + $HostedContentFilterPolicy = Get-HostedContentFilterPolicy -Identity $Identity-ErrorAction Stop if ($null -eq $HostedContentFilterPolicy) { Write-Verbose -Message "HostedContentFilterPolicy $($Identity) does not exist." @@ -344,12 +343,14 @@ function Get-TargetResource BulkSpamAction = $HostedContentFilterPolicy.BulkSpamAction BulkThreshold = $HostedContentFilterPolicy.BulkThreshold DownloadLink = $HostedContentFilterPolicy.DownloadLink - EnableEndUserSpamNotifications = $HostedContentFilterPolicy.EnableEndUserSpamNotifications + #Deprecated + #EnableEndUserSpamNotifications = $HostedContentFilterPolicy.EnableEndUserSpamNotifications EnableLanguageBlockList = $HostedContentFilterPolicy.EnableLanguageBlockList EnableRegionBlockList = $HostedContentFilterPolicy.EnableRegionBlockList - EndUserSpamNotificationCustomSubject = $HostedContentFilterPolicy.EndUserSpamNotificationCustomSubject - EndUserSpamNotificationFrequency = $HostedContentFilterPolicy.EndUserSpamNotificationFrequency - EndUserSpamNotificationLanguage = $HostedContentFilterPolicy.EndUserSpamNotificationLanguage + #Deprecated + #EndUserSpamNotificationCustomSubject = $HostedContentFilterPolicy.EndUserSpamNotificationCustomSubject + #EndUserSpamNotificationFrequency = $HostedContentFilterPolicy.EndUserSpamNotificationFrequency + #EndUserSpamNotificationLanguage = $HostedContentFilterPolicy.EndUserSpamNotificationLanguage HighConfidencePhishAction = $HostedContentFilterPolicy.HighConfidencePhishAction HighConfidencePhishQuarantineTag = $HostedContentFilterPolicy.HighConfidencePhishQuarantineTag HighConfidenceSpamAction = $HostedContentFilterPolicy.HighConfidenceSpamAction @@ -1055,6 +1056,10 @@ function Test-TargetResource $ValuesToCheck.Remove('CertificatePath') | Out-Null $ValuesToCheck.Remove('CertificatePassword') | Out-Null $ValuesToCheck.Remove('ManagedIdentity') | Out-Null + $ValuesToCheck.Remove('EnableEndUserSpamNotifications') | Out-Null + $ValuesToCheck.Remove('EndUserSpamNotificationLanguage') | Out-Null + $ValuesToCheck.Remove('EndUserSpamNotificationFrequency') | Out-Null + $ValuesToCheck.Remove('EndUserSpamNotificationCustomSubject') | Out-Null $TestResult = Test-M365DSCParameterState -CurrentValues $CurrentValues ` -Source $($MyInvocation.MyCommand.Source) ` diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOIntraOrganizationConnector/MSFT_EXOIntraOrganizationConnector.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOIntraOrganizationConnector/MSFT_EXOIntraOrganizationConnector.psm1 index 935ba37c9b..b70c9d634e 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOIntraOrganizationConnector/MSFT_EXOIntraOrganizationConnector.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOIntraOrganizationConnector/MSFT_EXOIntraOrganizationConnector.psm1 @@ -96,6 +96,11 @@ function Get-TargetResource } else { + $DiscoveryEndpointValue = $IntraOrganizationConnector.DiscoveryEndpoint.ToString() + if (-not $DiscoveryEndpointValue.EndsWith('/')) + { + $DiscoveryEndpointValue += '/' + } $result = @{ Identity = $Identity DiscoveryEndpoint = $IntraOrganizationConnector.DiscoveryEndpoint.ToString() diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOMalwareFilterRule/MSFT_EXOMalwareFilterRule.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOMalwareFilterRule/MSFT_EXOMalwareFilterRule.psm1 index b8a2a11c9b..4b9e2d62c5 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOMalwareFilterRule/MSFT_EXOMalwareFilterRule.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOMalwareFilterRule/MSFT_EXOMalwareFilterRule.psm1 @@ -122,10 +122,15 @@ function Get-TargetResource } else { + $EnabledValue = $false + if ($MalwareFilterRule.State -eq 'Enabled') + { + $EnabledValue = $true + } $result = @{ Identity = $Identity Comments = $MalwareFilterRule.Comments - Enabled = $MalwareFilterRule.Enabled + Enabled = $EnabledValue ExceptIfRecipientDomainIs = $MalwareFilterRule.ExceptIfRecipientDomainIs ExceptIfSentTo = $MalwareFilterRule.ExceptIfSentTo ExceptIfSentToMemberOf = $MalwareFilterRule.ExceptIfSentToMemberOf diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOMessageClassification/MSFT_EXOMessageClassification.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOMessageClassification/MSFT_EXOMessageClassification.psm1 index a877bc1820..8b49da6bed 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOMessageClassification/MSFT_EXOMessageClassification.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOMessageClassification/MSFT_EXOMessageClassification.psm1 @@ -105,9 +105,8 @@ function Get-TargetResource try { - $MessageClassifications = Get-MessageClassification -ErrorAction Stop + $MessageClassification = Get-MessageClassification -Identity $Identity -ErrorAction Stop - $MessageClassification = $MessageClassifications | Where-Object -FilterScript { $_.Identity -eq $Identity } if ($null -eq $MessageClassification) { Write-Verbose -Message "Message Classification policy $($Identity) does not exist." diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOOMEConfiguration/MSFT_EXOOMEConfiguration.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOOMEConfiguration/MSFT_EXOOMEConfiguration.psm1 index 3e8aaa3100..c9a7c719c6 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOOMEConfiguration/MSFT_EXOOMEConfiguration.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOOMEConfiguration/MSFT_EXOOMEConfiguration.psm1 @@ -132,7 +132,7 @@ function Get-TargetResource BackgroundColor = $OMEConfiguration.BackgroundColor DisclaimerText = $OMEConfiguration.DisclaimerText EmailText = $OMEConfiguration.EmailText - ExternalMailExpiryInDays = $OMEConfiguration.ExternalMailExpiryInDays + ExternalMailExpiryInDays = $OMEConfiguration.ExternalMailExpiryInterval.Days # Image = $OMEConfiguration.Image IntroductionText = $OMEConfiguration.IntroductionText OTPEnabled = $OMEConfiguration.OTPEnabled diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOSafeLinksPolicy/MSFT_EXOSafeLinksPolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOSafeLinksPolicy/MSFT_EXOSafeLinksPolicy.psm1 index 892843da04..d6ec4c16ab 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOSafeLinksPolicy/MSFT_EXOSafeLinksPolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOSafeLinksPolicy/MSFT_EXOSafeLinksPolicy.psm1 @@ -127,12 +127,9 @@ function Get-TargetResource $nullReturn.Ensure = 'Absent' try { - Write-Verbose -Message 'Global ExchangeOnlineSession status:' - Write-Verbose -Message "$( Get-PSSession -ErrorAction SilentlyContinue | Where-Object -FilterScript { $_.Name -eq 'ExchangeOnline' } | Out-String)" - try { - $SafeLinksPolicies = Get-SafeLinksPolicy -ErrorAction Stop + $SafeLinksPolicy = Get-SafeLinksPolicy -Identity $Identity -ErrorAction Stop } catch { @@ -141,8 +138,6 @@ function Get-TargetResource -Exception $_ ` -Source $MyInvocation.MyCommand.ModuleName } - - $SafeLinksPolicy = $SafeLinksPolicies | Where-Object -FilterScript { $_.Identity -eq $Identity } if (-not $SafeLinksPolicy) { Write-Verbose -Message "SafeLinksPolicy $($Identity) does not exist." @@ -165,7 +160,8 @@ function Get-TargetResource DisableUrlRewrite = $SafeLinksPolicy.DisableUrlRewrite ScanUrls = $SafeLinksPolicy.ScanUrls TrackClicks = $SafeLinksPolicy.TrackClicks - UseTranslatedNotificationText = $SafeLinksPolicy.UseTranslatedNotificationText + # The Get-SafeLinksPolicy no longer returns this property + # UseTranslatedNotificationText = $SafeLinksPolicy.UseTranslatedNotificationText Ensure = 'Present' Credential = $Credential ApplicationId = $ApplicationId @@ -472,6 +468,7 @@ function Test-TargetResource $ValuesToCheck.Remove('CertificatePath') | Out-Null $ValuesToCheck.Remove('CertificatePassword') | Out-Null $ValuesToCheck.Remove('ManagedIdentity') | Out-Null + $ValuesToCheck.Remove('UseTranslatedNotificationText') | Out-Null $TestResult = Test-M365DSCParameterState -CurrentValues $CurrentValues ` -Source $($MyInvocation.MyCommand.Source) ` diff --git a/Modules/Microsoft365DSC/Examples/Resources/EXOHostedContentFilterPolicy/1-Create.ps1 b/Modules/Microsoft365DSC/Examples/Resources/EXOHostedContentFilterPolicy/1-Create.ps1 index fd0ffdf943..28551c5cb8 100644 --- a/Modules/Microsoft365DSC/Examples/Resources/EXOHostedContentFilterPolicy/1-Create.ps1 +++ b/Modules/Microsoft365DSC/Examples/Resources/EXOHostedContentFilterPolicy/1-Create.ps1 @@ -22,12 +22,8 @@ Configuration Example BulkSpamAction = "MoveToJmf" BulkThreshold = 7 DownloadLink = $False - EnableEndUserSpamNotifications = $False EnableLanguageBlockList = $False EnableRegionBlockList = $False - EndUserSpamNotificationCustomSubject = "" - EndUserSpamNotificationFrequency = 3 - EndUserSpamNotificationLanguage = "Default" HighConfidencePhishAction = "Quarantine" HighConfidenceSpamAction = "MoveToJmf" IncreaseScoreWithBizOrInfoUrls = "Off" diff --git a/Modules/Microsoft365DSC/Examples/Resources/EXOHostedContentFilterPolicy/2-Update.ps1 b/Modules/Microsoft365DSC/Examples/Resources/EXOHostedContentFilterPolicy/2-Update.ps1 index ffecda1e04..836aef841f 100644 --- a/Modules/Microsoft365DSC/Examples/Resources/EXOHostedContentFilterPolicy/2-Update.ps1 +++ b/Modules/Microsoft365DSC/Examples/Resources/EXOHostedContentFilterPolicy/2-Update.ps1 @@ -22,12 +22,8 @@ Configuration Example BulkSpamAction = "MoveToJmf" BulkThreshold = 7 DownloadLink = $True # Updated Property - EnableEndUserSpamNotifications = $False EnableLanguageBlockList = $False EnableRegionBlockList = $False - EndUserSpamNotificationCustomSubject = "" - EndUserSpamNotificationFrequency = 3 - EndUserSpamNotificationLanguage = "Default" HighConfidencePhishAction = "Quarantine" HighConfidenceSpamAction = "MoveToJmf" IncreaseScoreWithBizOrInfoUrls = "Off" diff --git a/Modules/Microsoft365DSC/Examples/Resources/EXOHostedContentFilterRule/1-Create.ps1 b/Modules/Microsoft365DSC/Examples/Resources/EXOHostedContentFilterRule/1-Create.ps1 index d8f53e8694..af70c51640 100644 --- a/Modules/Microsoft365DSC/Examples/Resources/EXOHostedContentFilterRule/1-Create.ps1 +++ b/Modules/Microsoft365DSC/Examples/Resources/EXOHostedContentFilterRule/1-Create.ps1 @@ -13,6 +13,7 @@ Configuration Example ) Import-DscResource -ModuleName Microsoft365DSC + $Domain = $Credscredential.Username.Split('@')[1] node localhost { EXOHostedContentFilterRule 'ConfigureHostedContentFilterRule' @@ -20,7 +21,7 @@ Configuration Example Identity = "Integration CFR" Comments = "Applies to all users, except when member of HR group" Enabled = $True - ExceptIfSentToMemberOf = "Legal Team" + ExceptIfSentToMemberOf = "LegalTeam@$Domain" RecipientDomainIs = @('contoso.com') HostedContentFilterPolicy = "Integration CFP" Ensure = "Present" diff --git a/Modules/Microsoft365DSC/Examples/Resources/EXOHostedContentFilterRule/2-Update.ps1 b/Modules/Microsoft365DSC/Examples/Resources/EXOHostedContentFilterRule/2-Update.ps1 index 602414c835..b109c3907f 100644 --- a/Modules/Microsoft365DSC/Examples/Resources/EXOHostedContentFilterRule/2-Update.ps1 +++ b/Modules/Microsoft365DSC/Examples/Resources/EXOHostedContentFilterRule/2-Update.ps1 @@ -13,6 +13,7 @@ Configuration Example ) Import-DscResource -ModuleName Microsoft365DSC + $Domain = $Credscredential.Username.Split('@')[1] node localhost { EXOHostedContentFilterRule 'ConfigureHostedContentFilterRule' @@ -20,7 +21,7 @@ Configuration Example Identity = "Integration CFR" Comments = "Applies to all users, except when member of HR group" Enabled = $False # Updated Property - ExceptIfSentToMemberOf = "Legal Team" + ExceptIfSentToMemberOf = "LegalTeam@$Domain" RecipientDomainIs = @('contoso.com') HostedContentFilterPolicy = "Integration CFP" Ensure = "Present" diff --git a/Modules/Microsoft365DSC/Examples/Resources/EXOHostedOutboundSpamFilterRule/1-Create.ps1 b/Modules/Microsoft365DSC/Examples/Resources/EXOHostedOutboundSpamFilterRule/1-Create.ps1 index 9a861d1108..d9db058889 100644 --- a/Modules/Microsoft365DSC/Examples/Resources/EXOHostedOutboundSpamFilterRule/1-Create.ps1 +++ b/Modules/Microsoft365DSC/Examples/Resources/EXOHostedOutboundSpamFilterRule/1-Create.ps1 @@ -22,7 +22,7 @@ Configuration Example Comments = "Does not apply to Executives" Enabled = $True ExceptIfFrom = "AdeleV@$Domain" - FromMemberOf = 'Executives' + FromMemberOf = "Executives@$Domain" HostedOutboundSpamFilterPolicy = "Integration SFP" Ensure = "Present" Credential = $Credscredential diff --git a/Modules/Microsoft365DSC/Examples/Resources/EXOHostedOutboundSpamFilterRule/2-Update.ps1 b/Modules/Microsoft365DSC/Examples/Resources/EXOHostedOutboundSpamFilterRule/2-Update.ps1 index 36f324d0b3..15fa53328c 100644 --- a/Modules/Microsoft365DSC/Examples/Resources/EXOHostedOutboundSpamFilterRule/2-Update.ps1 +++ b/Modules/Microsoft365DSC/Examples/Resources/EXOHostedOutboundSpamFilterRule/2-Update.ps1 @@ -22,7 +22,7 @@ Configuration Example Comments = "Does not apply to Executives" Enabled = $False # Updated Property ExceptIfFrom = "AdeleV@$Domain" - FromMemberOf = 'Executives' + FromMemberOf = "Executives@$Domain" HostedOutboundSpamFilterPolicy = "Integration SFP" Ensure = "Present" Credential = $Credscredential diff --git a/Modules/Microsoft365DSC/Examples/Resources/EXOManagementRole/1-Create.ps1 b/Modules/Microsoft365DSC/Examples/Resources/EXOManagementRole/1-Create.ps1 index 86dac1533c..5be4191d19 100644 --- a/Modules/Microsoft365DSC/Examples/Resources/EXOManagementRole/1-Create.ps1 +++ b/Modules/Microsoft365DSC/Examples/Resources/EXOManagementRole/1-Create.ps1 @@ -12,13 +12,14 @@ Configuration Example ) Import-DscResource -ModuleName Microsoft365DSC + $Domain = $Credscredential.Username.Split('@')[1] node localhost { EXOManagementRole 'ConfigureManagementRole' { Name = "MyDisplayName" Description = "" - Parent = "contoso.onmicrosoft.com\MyProfileInformation" + Parent = "$Domain\MyProfileInformation" Ensure = "Present" Credential = $Credscredential } diff --git a/Modules/Microsoft365DSC/Examples/Resources/EXOManagementRole/2-Update.ps1 b/Modules/Microsoft365DSC/Examples/Resources/EXOManagementRole/2-Update.ps1 index 512cd43c77..d6094d3dca 100644 --- a/Modules/Microsoft365DSC/Examples/Resources/EXOManagementRole/2-Update.ps1 +++ b/Modules/Microsoft365DSC/Examples/Resources/EXOManagementRole/2-Update.ps1 @@ -12,13 +12,14 @@ Configuration Example ) Import-DscResource -ModuleName Microsoft365DSC + $Domain = $Credscredential.Username.Split('@')[1] node localhost { EXOManagementRole 'ConfigureManagementRole' { Name = "MyDisplayName" Description = "Updated Description" # Updated Property - Parent = "contoso.onmicrosoft.com\MyProfileInformation" + Parent = "$Domain\MyProfileInformation" Ensure = "Present" Credential = $Credscredential } diff --git a/Modules/Microsoft365DSC/Examples/Resources/EXOOfflineAddressBook/1-Create.ps1 b/Modules/Microsoft365DSC/Examples/Resources/EXOOfflineAddressBook/1-Create.ps1 index ce73e90fb1..013bc6e2f8 100644 --- a/Modules/Microsoft365DSC/Examples/Resources/EXOOfflineAddressBook/1-Create.ps1 +++ b/Modules/Microsoft365DSC/Examples/Resources/EXOOfflineAddressBook/1-Create.ps1 @@ -20,7 +20,7 @@ Configuration Example { Name = "Integration Address Book" AddressLists = @('\Offline Global Address List') - ConfiguredAttributes = @('OfficeLocation, ANR', 'ProxyAddresses, ANR', 'PhoneticGivenName, ANR', 'GivenName, ANR', 'PhoneticSurname, ANR', 'Surname, ANR', 'Account, ANR', 'PhoneticDisplayName, ANR', 'UserInformationDisplayName, ANR', 'ExternalMemberCount, Value', 'TotalMemberCount, Value', 'ModerationEnabled, Value', 'DelivContLength, Value', 'MailTipTranslations, Value', 'ObjectGuid, Value', 'IsOrganizational, Value', 'HabSeniorityIndex, Value', 'DisplayTypeEx, Value', 'SimpleDisplayNameAnsi, Value', 'HomeMdbA, Value', 'Certificate, Value', 'UserSMimeCertificate, Value', 'UserCertificate, Value', 'Comment, Value', 'PagerTelephoneNumber, Value', 'AssistantTelephoneNumber, Value', 'MobileTelephoneNumber, Value', 'PrimaryFaxNumber, Value', 'Home2TelephoneNumberMv, Value', 'Business2TelephoneNumberMv, Value', 'HomeTelephoneNumber, Value', 'TargetAddress, Value', 'PhoneticDepartmentName, Value', 'DepartmentName, Value', 'Assistant, Value', 'PhoneticCompanyName, Value', 'CompanyName, Value', 'Title, Value', 'Country, Value', 'PostalCode, Value', 'StateOrProvince, Value', 'Locality, Value', 'StreetAddress, Value', 'Initials, Value', 'BusinessTelephoneNumber, Value', 'SendRichInfo, Value', 'ObjectType, Value', 'DisplayType, Value', 'RejectMessagesFromDLMembers, Indicator', 'AcceptMessagesOnlyFromDLMembers, Indicator', 'RejectMessagesFrom, Indicator', 'AcceptMessagesOnlyFrom, Indicator', 'UmSpokenName, Indicator', 'ThumbnailPhoto, Indicator') + ConfiguredAttributes = @('OfficeLocation, ANR','ProxyAddresses, ANR','PhoneticGivenName, ANR','GivenName, ANR','PhoneticSurname, ANR','Surname, ANR','Account, ANR','PhoneticDisplayName, ANR','DisplayName, ANR','ExternalDirectoryObjectId, Value','ExternalMemberCount, Value','TotalMemberCount, Value','ModerationEnabled, Value','MailboxGuid, Value','DelivContLength, Value','MailTipTranslations, Value','ObjectGuid, Value','DisplayTypeEx, Value','DisplayNamePrintableAnsi, Value','HomeMdbA, Value','Certificate, Value','UserSMimeCertificate, Value','UserCertificate, Value','Comment, Value','PagerTelephoneNumber, Value','AssistantTelephoneNumber, Value','MobileTelephoneNumber, Value','PrimaryFaxNumber, Value','Home2TelephoneNumberMv, Value','Business2TelephoneNumberMv, Value','HomeTelephoneNumber, Value','TargetAddress, Value','PhoneticDepartmentName, Value','DepartmentName, Value','Assistant, Value','PhoneticCompanyName, Value','CompanyName, Value','Title, Value','Country, Value','PostalCode, Value','StateOrProvince, Value','Locality, Value','StreetAddress, Value','Initials, Value','BusinessTelephoneNumber, Value','SendRichInfo, Value','ObjectType, Value','DisplayType, Value','RejectMessagesFromDLMembers, Indicator','AcceptMessagesOnlyFromDLMembers, Indicator','RejectMessagesFrom, Indicator','AcceptMessagesOnlyFrom, Indicator','UmSpokenName, Indicator','ThumbnailPhoto, Indicator') DiffRetentionPeriod = "30" IsDefault = $true Ensure = "Present" diff --git a/Modules/Microsoft365DSC/Examples/Resources/EXOOfflineAddressBook/2-Update.ps1 b/Modules/Microsoft365DSC/Examples/Resources/EXOOfflineAddressBook/2-Update.ps1 index a6e6f375cf..4f7b9083af 100644 --- a/Modules/Microsoft365DSC/Examples/Resources/EXOOfflineAddressBook/2-Update.ps1 +++ b/Modules/Microsoft365DSC/Examples/Resources/EXOOfflineAddressBook/2-Update.ps1 @@ -20,7 +20,7 @@ Configuration Example { Name = "Integration Address Book" AddressLists = @('\Offline Global Address List') - ConfiguredAttributes = @('OfficeLocation, ANR', 'ProxyAddresses, ANR', 'PhoneticGivenName, ANR', 'GivenName, ANR', 'PhoneticSurname, ANR', 'Surname, ANR', 'Account, ANR', 'PhoneticDisplayName, ANR', 'UserInformationDisplayName, ANR', 'ExternalMemberCount, Value', 'TotalMemberCount, Value', 'ModerationEnabled, Value', 'DelivContLength, Value', 'MailTipTranslations, Value', 'ObjectGuid, Value', 'IsOrganizational, Value', 'HabSeniorityIndex, Value', 'DisplayTypeEx, Value', 'SimpleDisplayNameAnsi, Value', 'HomeMdbA, Value', 'Certificate, Value', 'UserSMimeCertificate, Value', 'UserCertificate, Value', 'Comment, Value', 'PagerTelephoneNumber, Value', 'AssistantTelephoneNumber, Value', 'MobileTelephoneNumber, Value', 'PrimaryFaxNumber, Value', 'Home2TelephoneNumberMv, Value', 'Business2TelephoneNumberMv, Value', 'HomeTelephoneNumber, Value', 'TargetAddress, Value', 'PhoneticDepartmentName, Value', 'DepartmentName, Value', 'Assistant, Value', 'PhoneticCompanyName, Value', 'CompanyName, Value', 'Title, Value', 'Country, Value', 'PostalCode, Value', 'StateOrProvince, Value', 'Locality, Value', 'StreetAddress, Value', 'Initials, Value', 'BusinessTelephoneNumber, Value', 'SendRichInfo, Value', 'ObjectType, Value', 'DisplayType, Value', 'RejectMessagesFromDLMembers, Indicator', 'AcceptMessagesOnlyFromDLMembers, Indicator', 'RejectMessagesFrom, Indicator', 'AcceptMessagesOnlyFrom, Indicator', 'UmSpokenName, Indicator', 'ThumbnailPhoto, Indicator') + ConfiguredAttributes = @('OfficeLocation, ANR','ProxyAddresses, ANR','PhoneticGivenName, ANR','GivenName, ANR','PhoneticSurname, ANR','Surname, ANR','Account, ANR','PhoneticDisplayName, ANR','DisplayName, ANR','ExternalDirectoryObjectId, Value','ExternalMemberCount, Value','TotalMemberCount, Value','ModerationEnabled, Value','MailboxGuid, Value','DelivContLength, Value','MailTipTranslations, Value','ObjectGuid, Value','DisplayTypeEx, Value','DisplayNamePrintableAnsi, Value','HomeMdbA, Value','Certificate, Value','UserSMimeCertificate, Value','UserCertificate, Value','Comment, Value','PagerTelephoneNumber, Value','AssistantTelephoneNumber, Value','MobileTelephoneNumber, Value','PrimaryFaxNumber, Value','Home2TelephoneNumberMv, Value','Business2TelephoneNumberMv, Value','HomeTelephoneNumber, Value','TargetAddress, Value','PhoneticDepartmentName, Value','DepartmentName, Value','Assistant, Value','PhoneticCompanyName, Value','CompanyName, Value','Title, Value','Country, Value','PostalCode, Value','StateOrProvince, Value','Locality, Value','StreetAddress, Value','Initials, Value','BusinessTelephoneNumber, Value','SendRichInfo, Value','ObjectType, Value','DisplayType, Value','RejectMessagesFromDLMembers, Indicator','AcceptMessagesOnlyFromDLMembers, Indicator','RejectMessagesFrom, Indicator','AcceptMessagesOnlyFrom, Indicator','UmSpokenName, Indicator','ThumbnailPhoto, Indicator') DiffRetentionPeriod = "30" IsDefault = $false # Updated Property Ensure = "Present" diff --git a/Modules/Microsoft365DSC/Examples/Resources/EXORemoteDomain/1-Create.ps1 b/Modules/Microsoft365DSC/Examples/Resources/EXORemoteDomain/1-Create.ps1 index a3887a84fa..885d097448 100644 --- a/Modules/Microsoft365DSC/Examples/Resources/EXORemoteDomain/1-Create.ps1 +++ b/Modules/Microsoft365DSC/Examples/Resources/EXORemoteDomain/1-Create.ps1 @@ -25,7 +25,7 @@ Configuration Example ContentType = "MimeHtmlText" DeliveryReportEnabled = $True DisplaySenderName = $True - DomainName = "*" + DomainName = "contoso.com" IsInternal = $False LineWrapSize = "Unlimited" MeetingForwardNotificationEnabled = $False diff --git a/Modules/Microsoft365DSC/Examples/Resources/EXORemoteDomain/2-Update.ps1 b/Modules/Microsoft365DSC/Examples/Resources/EXORemoteDomain/2-Update.ps1 index 4aace58ca5..22d9d7249d 100644 --- a/Modules/Microsoft365DSC/Examples/Resources/EXORemoteDomain/2-Update.ps1 +++ b/Modules/Microsoft365DSC/Examples/Resources/EXORemoteDomain/2-Update.ps1 @@ -25,7 +25,7 @@ Configuration Example ContentType = "MimeHtmlText" DeliveryReportEnabled = $True DisplaySenderName = $True - DomainName = "*" + DomainName = "contoso.com" IsInternal = $False LineWrapSize = "Integration" MeetingForwardNotificationEnabled = $False diff --git a/Modules/Microsoft365DSC/Examples/Resources/EXOSafeAttachmentRule/1-Create.ps1 b/Modules/Microsoft365DSC/Examples/Resources/EXOSafeAttachmentRule/1-Create.ps1 index feab8da8eb..255584dbd0 100644 --- a/Modules/Microsoft365DSC/Examples/Resources/EXOSafeAttachmentRule/1-Create.ps1 +++ b/Modules/Microsoft365DSC/Examples/Resources/EXOSafeAttachmentRule/1-Create.ps1 @@ -13,6 +13,7 @@ Configuration Example ) Import-DscResource -ModuleName Microsoft365DSC + $Domain = $Credscredential.Username.Split('@')[1] node localhost { EXOSafeAttachmentRule 'ConfigureSafeAttachmentRule' @@ -20,9 +21,9 @@ Configuration Example Identity = "Research Department Attachment Rule" Comments = "Applies to Research Department, except managers" Enabled = $True - ExceptIfSentToMemberOf = "Executives" + ExceptIfSentToMemberOf = "Executives@$Domain" SafeAttachmentPolicy = "Marketing Block Attachments" - SentToMemberOf = "Legal Team" + SentToMemberOf = "LegalTeam@$Domain" Ensure = "Present" Credential = $Credscredential } diff --git a/Modules/Microsoft365DSC/Examples/Resources/EXOSafeAttachmentRule/2-Update.ps1 b/Modules/Microsoft365DSC/Examples/Resources/EXOSafeAttachmentRule/2-Update.ps1 index 419c6f7d0d..6aa8a4a02b 100644 --- a/Modules/Microsoft365DSC/Examples/Resources/EXOSafeAttachmentRule/2-Update.ps1 +++ b/Modules/Microsoft365DSC/Examples/Resources/EXOSafeAttachmentRule/2-Update.ps1 @@ -13,6 +13,7 @@ Configuration Example ) Import-DscResource -ModuleName Microsoft365DSC + $Domain = $Credscredential.Username.Split('@')[1] node localhost { EXOSafeAttachmentRule 'ConfigureSafeAttachmentRule' @@ -20,9 +21,9 @@ Configuration Example Identity = "Research Department Attachment Rule" Comments = "Applies to Research Department, except managers" Enabled = $False # Updated Property - ExceptIfSentToMemberOf = "Executives" + ExceptIfSentToMemberOf = "Executives@$Domain" SafeAttachmentPolicy = "Marketing Block Attachments" - SentToMemberOf = "Legal Team" + SentToMemberOf = "LegalTeam@$Domain" Ensure = "Present" Credential = $Credscredential } diff --git a/Modules/Microsoft365DSC/Examples/Resources/EXOSafeLinksPolicy/1-Create.ps1 b/Modules/Microsoft365DSC/Examples/Resources/EXOSafeLinksPolicy/1-Create.ps1 index c0f0456700..1d27ca318e 100644 --- a/Modules/Microsoft365DSC/Examples/Resources/EXOSafeLinksPolicy/1-Create.ps1 +++ b/Modules/Microsoft365DSC/Examples/Resources/EXOSafeLinksPolicy/1-Create.ps1 @@ -24,7 +24,6 @@ Configuration Example EnableOrganizationBranding = $True EnableSafeLinksForTeams = $True ScanUrls = $True - UseTranslatedNotificationText = $True Ensure = 'Present' Credential = $Credscredential } diff --git a/Modules/Microsoft365DSC/Examples/Resources/EXOSafeLinksPolicy/2-Update.ps1 b/Modules/Microsoft365DSC/Examples/Resources/EXOSafeLinksPolicy/2-Update.ps1 index 09de5e45b7..ae083d94a0 100644 --- a/Modules/Microsoft365DSC/Examples/Resources/EXOSafeLinksPolicy/2-Update.ps1 +++ b/Modules/Microsoft365DSC/Examples/Resources/EXOSafeLinksPolicy/2-Update.ps1 @@ -24,7 +24,6 @@ Configuration Example EnableOrganizationBranding = $False # Updated Property EnableSafeLinksForTeams = $True ScanUrls = $True - UseTranslatedNotificationText = $True Ensure = 'Present' Credential = $Credscredential } diff --git a/Modules/Microsoft365DSC/Examples/Resources/EXOSafeLinksRule/1-Create.ps1 b/Modules/Microsoft365DSC/Examples/Resources/EXOSafeLinksRule/1-Create.ps1 index 93694876a8..f89887d86b 100644 --- a/Modules/Microsoft365DSC/Examples/Resources/EXOSafeLinksRule/1-Create.ps1 +++ b/Modules/Microsoft365DSC/Examples/Resources/EXOSafeLinksRule/1-Create.ps1 @@ -13,6 +13,7 @@ Configuration Example ) Import-DscResource -ModuleName Microsoft365DSC + $Domain = $Credscredential.Username.Split('@')[1] node localhost { EXOSafeLinksRule 'ConfigureSafeLinksRule' @@ -20,9 +21,9 @@ Configuration Example Identity = "Research Department URL Rule" Comments = "Applies to Research Department, except managers" Enabled = $True - ExceptIfSentToMemberOf = "Executives" + ExceptIfSentToMemberOf = "Executives@$Domain" SafeLinksPolicy = "Marketing Block URL" - SentToMemberOf = "Legal Team" + SentToMemberOf = "LegalTeam@$Domain" Ensure = "Present" Credential = $Credscredential } diff --git a/Modules/Microsoft365DSC/Examples/Resources/EXOSafeLinksRule/2-Update.ps1 b/Modules/Microsoft365DSC/Examples/Resources/EXOSafeLinksRule/2-Update.ps1 index a01e4f058d..c86aa8e09a 100644 --- a/Modules/Microsoft365DSC/Examples/Resources/EXOSafeLinksRule/2-Update.ps1 +++ b/Modules/Microsoft365DSC/Examples/Resources/EXOSafeLinksRule/2-Update.ps1 @@ -13,6 +13,7 @@ Configuration Example ) Import-DscResource -ModuleName Microsoft365DSC + $Domain = $Credscredential.Username.Split('@')[1] node localhost { EXOSafeLinksRule 'ConfigureSafeLinksRule' @@ -20,9 +21,9 @@ Configuration Example Identity = "Research Department URL Rule" Comments = "Applies to Research Department, except managers" Enabled = $False # Updated Property - ExceptIfSentToMemberOf = "Executives" + ExceptIfSentToMemberOf = "Executives@$Domain" SafeLinksPolicy = "Marketing Block URL" - SentToMemberOf = "Legal Team" + SentToMemberOf = "LegalTeam@$Domain" Ensure = "Present" Credential = $Credscredential } diff --git a/Modules/Microsoft365DSC/Examples/Resources/EXOTransportRule/1-Create.ps1 b/Modules/Microsoft365DSC/Examples/Resources/EXOTransportRule/1-Create.ps1 index 4b79f0fa53..3fb7c0a9fe 100644 --- a/Modules/Microsoft365DSC/Examples/Resources/EXOTransportRule/1-Create.ps1 +++ b/Modules/Microsoft365DSC/Examples/Resources/EXOTransportRule/1-Create.ps1 @@ -13,13 +13,14 @@ Configuration Example ) Import-DscResource -ModuleName Microsoft365DSC + $Domain = $Credscredential.Username.Split('@')[1] node localhost { EXOTransportRule 'ConfigureTransportRule' { Name = "Ethical Wall - Sales and Executives Departments" - BetweenMemberOf1 = "Sales Team" - BetweenMemberOf2 = "Executives" + BetweenMemberOf1 = "SalesTeam@$Domain" + BetweenMemberOf2 = "Executives@$Domain" ExceptIfFrom = "AdeleV@$Domain" ExceptIfSubjectContainsWords = "Press Release","Corporate Communication" RejectMessageReasonText = "Messages sent between the Sales and Brokerage departments are strictly prohibited." diff --git a/Modules/Microsoft365DSC/Examples/Resources/EXOTransportRule/2-Update.ps1 b/Modules/Microsoft365DSC/Examples/Resources/EXOTransportRule/2-Update.ps1 index 8ef3a7d5ae..ebec921bdd 100644 --- a/Modules/Microsoft365DSC/Examples/Resources/EXOTransportRule/2-Update.ps1 +++ b/Modules/Microsoft365DSC/Examples/Resources/EXOTransportRule/2-Update.ps1 @@ -13,13 +13,14 @@ Configuration Example ) Import-DscResource -ModuleName Microsoft365DSC + $Domain = $Credscredential.Username.Split('@')[1] node localhost { EXOTransportRule 'ConfigureTransportRule' { Name = "Ethical Wall - Sales and Executives Departments" - BetweenMemberOf1 = "Sales Team" - BetweenMemberOf2 = "Executives" + BetweenMemberOf1 = "SalesTeam@$Domain" + BetweenMemberOf2 = "Executives@$Domain" ExceptIfFrom = "AdeleV@$Domain" ExceptIfSubjectContainsWords = "Press Release","Corporate Communication" RejectMessageReasonText = "Messages sent between the Sales and Brokerage departments are strictly prohibited." From f16ba5d45150c62571443e6cdfe686b8fb785eeb Mon Sep 17 00:00:00 2001 From: Nik Charlebois Date: Tue, 30 Jan 2024 16:42:41 -0500 Subject: [PATCH 2/3] Fixes --- .../Examples/Resources/EXOAntiPhishRule/1-Create.ps1 | 6 ------ .../Examples/Resources/EXOAntiPhishRule/2-Update.ps1 | 5 ----- 2 files changed, 11 deletions(-) diff --git a/Modules/Microsoft365DSC/Examples/Resources/EXOAntiPhishRule/1-Create.ps1 b/Modules/Microsoft365DSC/Examples/Resources/EXOAntiPhishRule/1-Create.ps1 index e2f6aeeba4..03b2094ac1 100644 --- a/Modules/Microsoft365DSC/Examples/Resources/EXOAntiPhishRule/1-Create.ps1 +++ b/Modules/Microsoft365DSC/Examples/Resources/EXOAntiPhishRule/1-Create.ps1 @@ -18,13 +18,7 @@ Configuration Example EXOAntiPhishRule 'ConfigureAntiPhishRule' { Identity = "Test Rule" - ExceptIfSentToMemberOf = $null - ExceptIfSentTo = $null - SentTo = $null - ExceptIfRecipientDomainIs = $null - Comments = $null AntiPhishPolicy = "Our Rule" - RecipientDomainIs = $null Enabled = $True SentToMemberOf = @("executives@$Domain") Ensure = "Present" diff --git a/Modules/Microsoft365DSC/Examples/Resources/EXOAntiPhishRule/2-Update.ps1 b/Modules/Microsoft365DSC/Examples/Resources/EXOAntiPhishRule/2-Update.ps1 index 210bb04776..622f37e92b 100644 --- a/Modules/Microsoft365DSC/Examples/Resources/EXOAntiPhishRule/2-Update.ps1 +++ b/Modules/Microsoft365DSC/Examples/Resources/EXOAntiPhishRule/2-Update.ps1 @@ -18,13 +18,8 @@ Configuration Example EXOAntiPhishRule 'ConfigureAntiPhishRule' { Identity = "Test Rule" - ExceptIfSentToMemberOf = $null - ExceptIfSentTo = $null - SentTo = $null - ExceptIfRecipientDomainIs = $null Comments = "This is an updated comment." # Updated Property AntiPhishPolicy = "Our Rule" - RecipientDomainIs = $null Enabled = $True SentToMemberOf = @("executives@$Domain") Ensure = "Present" From 97c7195d206b79cfcd927c56c10ca74004f267c9 Mon Sep 17 00:00:00 2001 From: Nik Charlebois Date: Tue, 30 Jan 2024 17:18:53 -0500 Subject: [PATCH 3/3] Fixes Unit Tests --- .../MSFT_EXOAvailabilityAddressSpace.psm1 | 6 +-- ...SFT_EXOAvailabilityAddressSpace.schema.mof | 2 +- .../MSFT_EXOHostedContentFilterPolicy.psm1 | 3 +- .../MSFT_EXOMalwareFilterRule.psm1 | 4 +- ...5DSC.EXOAvailabilityAddressSpace.Tests.ps1 | 10 ++--- ...soft365DSC.EXOAvailabilityConfig.Tests.ps1 | 14 ++++--- ...osoft365DSC.EXODistributionGroup.Tests.ps1 | 37 ++++++++++++++++--- ...DSC.EXOHostedContentFilterPolicy.Tests.ps1 | 7 ---- ...osoft365DSC.EXOMalwareFilterRule.Tests.ps1 | 11 ++---- 9 files changed, 54 insertions(+), 40 deletions(-) diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOAvailabilityAddressSpace/MSFT_EXOAvailabilityAddressSpace.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOAvailabilityAddressSpace/MSFT_EXOAvailabilityAddressSpace.psm1 index 24224289d7..614702f42b 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOAvailabilityAddressSpace/MSFT_EXOAvailabilityAddressSpace.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOAvailabilityAddressSpace/MSFT_EXOAvailabilityAddressSpace.psm1 @@ -10,7 +10,7 @@ function Get-TargetResource $Identity, [Parameter()] - [ValidateSet('PerUserFB', 'OrgWideFB', 'OrgWideFBBasic', 'InternalProxy')] + [ValidateSet('PerUserFB', 'OrgWideFB', 'OrgWideFBToken', 'OrgWideFBBasic', 'InternalProxy')] [System.String] $AccessMethod, @@ -169,7 +169,7 @@ function Set-TargetResource $Identity, [Parameter()] - [ValidateSet('PerUserFB', 'OrgWideFB', 'OrgWideFBBasic', 'InternalProxy')] + [ValidateSet('PerUserFB', 'OrgWideFB', 'OrgWideFBToken', 'OrgWideFBBasic', 'InternalProxy')] [System.String] $AccessMethod, @@ -337,7 +337,7 @@ function Test-TargetResource $Identity, [Parameter()] - [ValidateSet('PerUserFB', 'OrgWideFB', 'OrgWideFBBasic', 'InternalProxy')] + [ValidateSet('PerUserFB', 'OrgWideFB', 'OrgWideFBToken', 'OrgWideFBBasic', 'InternalProxy')] [System.String] $AccessMethod, diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOAvailabilityAddressSpace/MSFT_EXOAvailabilityAddressSpace.schema.mof b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOAvailabilityAddressSpace/MSFT_EXOAvailabilityAddressSpace.schema.mof index 12da6f39d9..e7a1374760 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOAvailabilityAddressSpace/MSFT_EXOAvailabilityAddressSpace.schema.mof +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOAvailabilityAddressSpace/MSFT_EXOAvailabilityAddressSpace.schema.mof @@ -3,7 +3,7 @@ class MSFT_EXOAvailabilityAddressSpace : OMI_BaseResource { [Key, Description("The Identity parameter specifies the AvailabilityAddressSpace you want to modify.")] String Identity; - [Write, Description("The AccessMethod parameter specifies how the free/busy data is accessed. Valid values are:PerUserFB, OrgWideFB, OrgWideFBBasic,InternalProxy"), ValueMap{"PerUserFB","OrgWideFB","OrgWideFBBasic","InternalProxy"}, Values{"PerUserFB","OrgWideFB","OrgWideFBBasic","InternalProxy"}] String AccessMethod; + [Write, Description("The AccessMethod parameter specifies how the free/busy data is accessed. Valid values are:PerUserFB, OrgWideFB, OrgWideFBToken, OrgWideFBBasic,InternalProxy"), ValueMap{"PerUserFB","OrgWideFB","OrgWideFBToken","OrgWideFBBasic","InternalProxy"}, Values{"PerUserFB","OrgWideFB","OrgWideFBToken","OrgWideFBBasic","InternalProxy"}] String AccessMethod; [Write, Description("The Credentials parameter specifies the username and password that's used to access the Availability services in the target forest.")] String Credentials; [Write, Description("The ForestName parameter specifies the SMTP domain name of the target forest for users whose free/busy data must be retrieved. If your users are distributed among multiple SMTP domains in the target forest, run the Add-AvailabilityAddressSpace command once for each SMTP domain.")] String ForestName; [Write, Description("The TargetAutodiscoverEpr parameter specifies the Autodiscover URL of Exchange Web Services for the external organization. Exchange uses Autodiscover to automatically detect the correct server endpoint for external requests.")] String TargetAutodiscoverEpr; diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOHostedContentFilterPolicy/MSFT_EXOHostedContentFilterPolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOHostedContentFilterPolicy/MSFT_EXOHostedContentFilterPolicy.psm1 index 1cf252701b..90c58d92c2 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOHostedContentFilterPolicy/MSFT_EXOHostedContentFilterPolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOHostedContentFilterPolicy/MSFT_EXOHostedContentFilterPolicy.psm1 @@ -303,7 +303,7 @@ function Get-TargetResource $nullReturn.Ensure = 'Absent' try { - $HostedContentFilterPolicy = Get-HostedContentFilterPolicy -Identity $Identity-ErrorAction Stop + $HostedContentFilterPolicy = Get-HostedContentFilterPolicy -Identity $Identity -ErrorAction Stop if ($null -eq $HostedContentFilterPolicy) { Write-Verbose -Message "HostedContentFilterPolicy $($Identity) does not exist." @@ -407,6 +407,7 @@ function Get-TargetResource } catch { + Write-Verbose -Message $_ New-M365DSCLogEntry -Message 'Error retrieving data:' ` -Exception $_ ` -Source $($MyInvocation.MyCommand.Source) ` diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOMalwareFilterRule/MSFT_EXOMalwareFilterRule.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOMalwareFilterRule/MSFT_EXOMalwareFilterRule.psm1 index 4b9e2d62c5..e04646db5b 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOMalwareFilterRule/MSFT_EXOMalwareFilterRule.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOMalwareFilterRule/MSFT_EXOMalwareFilterRule.psm1 @@ -112,9 +112,7 @@ function Get-TargetResource $nullReturn.Ensure = 'Absent' try { - $MalwareFilterRules = Get-MalwareFilterRule -ErrorAction Stop - - $MalwareFilterRule = $MalwareFilterRules | Where-Object -FilterScript { $_.Identity -eq $Identity } + $MalwareFilterRule = Get-MalwareFilterRule -Identity $Identity -ErrorAction SilentlyContinue if ($null -eq $MalwareFilterRule) { Write-Verbose -Message "MalwareFilterRule $($Identity) does not exist." diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOAvailabilityAddressSpace.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOAvailabilityAddressSpace.Tests.ps1 index 03e7bd73d9..082ebc201b 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOAvailabilityAddressSpace.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOAvailabilityAddressSpace.Tests.ps1 @@ -57,16 +57,14 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Credential = $Credential Ensure = 'Present' Identity = 'contoso.com' - AccessMethod = 'OrgWideFB' - Credentials = $Null + AccessMethod = 'OrgWideFBToken' ForestName = 'contoso.com' - TargetAutodiscoverEpr = 'http://autodiscover.contoso.com/autodiscover/autodiscover.xml' + TargetServiceEpr = 'http://autodiscover.contoso.com/autodiscover/autodiscover.xml' + TargetTenantId = 'contoso.com' } Mock -CommandName Get-AvailabilityAddressSpace -MockWith { - return @{ - Identity = 'SomeOtherConnector' - } + return $null } } diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOAvailabilityConfig.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOAvailabilityConfig.Tests.ps1 index 21f2a299cb..15281ce041 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOAvailabilityConfig.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOAvailabilityConfig.Tests.ps1 @@ -52,9 +52,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName Get-AvailabilityConfig -MockWith { - return @{ - OrgWideAccount = 'meganb' - } + return $null } Mock -CommandName Set-AvailabilityConfig -MockWith { @@ -86,12 +84,16 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Absent' Credential = $Credential } - - Mock -CommandName Get-AvailabilityConfig -MockWith { + + Mock -CommandName Get-MgUser -MockWith { return @{ - OrgWideAccount = 'meganb' + UserPrincipalName = 'johndoe' } } + + Mock -CommandName Get-AvailabilityConfig -MockWith { + return $null + } } It 'Should return Absent from the Get method' { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXODistributionGroup.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXODistributionGroup.Tests.ps1 index 791f795732..d63570c9af 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXODistributionGroup.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXODistributionGroup.Tests.ps1 @@ -109,7 +109,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { ManagedBy = @('john.smith@contoso.com') MemberDepartRestriction = 'Open' MemberJoinRestriction = 'Closed' - ModeratedBy = @('admin@contoso.com') + ModeratedBy = @('john.smith@contoso.com') ModerationEnabled = $False Identity = 'DemoDG' Name = 'DemoDG' @@ -119,6 +119,13 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { SendModerationNotifications = 'Always' Credential = $Credential } + + + Mock -CommandName Get-MgUser -MockWith { + return @{ + UserPrincipalName = 'john.smith@contoso.com' + } + } Mock -CommandName Get-DistributionGroup -MockWith { return @{ @@ -130,7 +137,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { ManagedBy = @('john.smith@contoso.com') MemberDepartRestriction = 'Open' MemberJoinRestriction = 'Open' # Drift - ModeratedBy = @('admin@contoso.com') + ModeratedBy = @('john.smith@contoso.com') ModerationEnabled = $False Identity = 'DemoDG' Name = 'DemoDG' @@ -169,7 +176,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { ManagedBy = @('john.smith@contoso.com') MemberDepartRestriction = 'Open' MemberJoinRestriction = 'Closed' - ModeratedBy = @('admin@contoso.com') + ModeratedBy = @('john.smith@contoso.com') ModerationEnabled = $False Identity = 'DemoDG' Name = 'DemoDG' @@ -179,6 +186,12 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { SendModerationNotifications = 'Always' Credential = $Credential } + + Mock -CommandName Get-MgUser -MockWith { + return @{ + UserPrincipalName = 'john.smith@contoso.com' + } + } Mock -CommandName Get-DistributionGroup -MockWith { return @{ @@ -190,7 +203,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { ManagedBy = @('john.smith@contoso.com') MemberDepartRestriction = 'Open' MemberJoinRestriction = 'Closed' - ModeratedBy = @('admin@contoso.com') + ModeratedBy = @('john.smith@contoso.com') ModerationEnabled = $False Identity = 'DemoDG' Name = 'DemoDG' @@ -224,7 +237,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { ManagedBy = @('john.smith@contoso.com') MemberDepartRestriction = 'Open' MemberJoinRestriction = 'Closed' - ModeratedBy = @('admin@contoso.com') + ModeratedBy = @('john.smith@contoso.com') ModerationEnabled = $False Identity = 'DemoDG' Name = 'DemoDG' @@ -234,6 +247,12 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { SendModerationNotifications = 'Always' Credential = $Credential } + + Mock -CommandName Get-MgUser -MockWith { + return @{ + UserPrincipalName = 'john.smith@contoso.com' + } + } Mock -CommandName Get-DistributionGroup -MockWith { return @{ @@ -245,7 +264,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { ManagedBy = @('john.smith@contoso.com') MemberDepartRestriction = 'Open' MemberJoinRestriction = 'Closed' - ModeratedBy = @('admin@contoso.com') + ModeratedBy = @('john.smith@contoso.com') ModerationEnabled = $False Identity = 'DemoDG' Name = 'DemoDG' @@ -279,6 +298,12 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } + + Mock -CommandName Get-MgUser -MockWith { + return @{ + UserPrincipalName = 'john.smith@contoso.com' + } + } Mock -CommandName Get-DistributionGroup -MockWith { return @{ diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOHostedContentFilterPolicy.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOHostedContentFilterPolicy.Tests.ps1 index 06966ab348..49e1d983d3 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOHostedContentFilterPolicy.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOHostedContentFilterPolicy.Tests.ps1 @@ -63,7 +63,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { RedirectToRecipients = @() TestModeBccToRecipients = @() QuarantineRetentionPeriod = 15 - EndUserSpamNotificationFrequency = 1 TestModeAction = 'AddXHeader' IncreaseScoreWithImageLinks = 'Off' IncreaseScoreWithNumericIps = 'On' @@ -177,16 +176,13 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Mock -CommandName Get-HostedContentFilterPolicy -MockWith { return @{ - Ensure = 'Present' Identity = 'TestPolicy' - Credential = $Credential AdminDisplayName = 'This ContentFilter policiy is a test' AddXHeaderValue = 'MyCustomSpamHeader' ModifySubjectValue = 'SPAM!' RedirectToRecipients = @() TestModeBccToRecipients = @() QuarantineRetentionPeriod = 15 - EndUserSpamNotificationFrequency = 1 TestModeAction = 'AddXHeader' IncreaseScoreWithImageLinks = 'Off' IncreaseScoreWithNumericIps = 'On' @@ -209,12 +205,9 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { HighConfidencePhishAction = 'Quarantine' HighConfidenceSpamAction = 'Quarantine' SpamAction = 'MoveToJmf' - EnableEndUserSpamNotifications = $true DownloadLink = $false EnableRegionBlockList = $true EnableLanguageBlockList = $true - EndUserSpamNotificationCustomSubject = 'This is SPAM' - EndUserSpamNotificationLanguage = 'Default' BulkThreshold = 5 AllowedSenders = @{ Sender = @( diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOMalwareFilterRule.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOMalwareFilterRule.Tests.ps1 index 7e1dd5a1ce..ca6696b7ff 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOMalwareFilterRule.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOMalwareFilterRule.Tests.ps1 @@ -71,9 +71,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName Get-MalwareFilterRule -MockWith { - return @{ - Identity = 'SomeOtherMalwareFilterRule' - } + return $null } } @@ -110,8 +108,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Mock -CommandName Get-MalwareFilterRule -MockWith { return @{ - Ensure = 'Present' - Credential = $Credential Identity = 'TestMalwareFilterRule' Comments = 'This is a test rule' Enabled = $true @@ -121,6 +117,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { MalwareFilterPolicy = 'Policy1' Priority = '1' RecipientDomainIs = 'contoso.com' + State = 'Enabled' SentTo = @('will@contoso.com', 'bernadette@contoso.org') SentToMemberOf = @('Testgroup3', 'testgroup4') } @@ -152,11 +149,10 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Mock -CommandName Get-MalwareFilterRule -MockWith { return @{ - Ensure = 'Present' - Credential = $Credential Identity = 'TestMalwareFilterRule' Comments = 'This is a test rule' Enabled = $true + State = 'Enabled' ExceptIfRecipientDomainIs = 'firma.de' ExceptIfSentTo = 'clausi@contoso.com' ExceptIfSentToMemberOf = 'Testgroup1' @@ -230,6 +226,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { ExceptIfSentTo = 'clausi@contoso.com' ExceptIfSentToMemberOf = 'Testgroup1' MalwareFilterPolicy = 'Policy1' + State = 'Enabled' Priority = '2' RecipientDomainIs = 'contoso.com' SentTo = 'will@contoso.com'