Skip to content

Commit

Permalink
Merge branch 'Dev' into fix/array-comparison-in-report
Browse files Browse the repository at this point in the history
  • Loading branch information
FabienTschanz committed Jul 16, 2024
2 parents 17f1514 + 01a0b67 commit fa8c008
Show file tree
Hide file tree
Showing 40 changed files with 57 additions and 81 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

# UNRELEASED

* EXOHostedOutboundSpamFilterPolicy
* Changed the RecipientLimitInternalPerHour, RecipientLimitPerDay, and
RecipientLimitExternalPerHour parameters to UInt32.
* M365DSCReport
* Changes behaviour to not throw on empty configuration during report generation.
FIXES [#4559](https://github.com/microsoft/Microsoft365DSC/issues/4559)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function Get-TargetResource
$AccessTokens
)

Write-Verbose -Message "Getting configuration of HostedContentFilterRule for $Identity"
Write-Verbose -Message "Getting configuration of HostedContentFilterRule for [$Identity]"

#Ensure the proper dependencies are installed in the current environment.
Confirm-M365DSCDependencies
Expand Down Expand Up @@ -122,10 +122,19 @@ function Get-TargetResource
}
catch
{
$Message = 'Error calling {Get-HostedContentFilterRule}'
New-M365DSCLogEntry -Message $Message `
-Exception $_ `
-Source $MyInvocation.MyCommand.ModuleName
try
{
Write-Verbose -Message "Couldn't find rule by ID, trying by name."
$rules = Get-HostedContentFilterRule
$HostedContentFilterRule = $rules | Where-Object -FilterScript {$_.Name -eq $Identity -and $_.HostedContentFilterPolicy -eq $HostedContentFilterPolicy}
}
catch
{
$Message = 'Error calling {Get-HostedContentFilterRule}'
New-M365DSCLogEntry -Message $Message `
-Exception $_ `
-Source $MyInvocation.MyCommand.ModuleName
}
}
if (-not $HostedContentFilterRule)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ function Get-TargetResource
$NotifyOutboundSpam = $true,

[Parameter()]
[System.String]
[System.UInt32]
$RecipientLimitInternalPerHour,

[Parameter()]
[System.String]
[System.UInt32]
$RecipientLimitPerDay,

[Parameter()]
[System.String]
[System.UInt32]
$RecipientLimitExternalPerHour,

[Parameter()]
Expand Down Expand Up @@ -196,15 +196,15 @@ function Set-TargetResource
$NotifyOutboundSpam = $true,

[Parameter()]
[System.String]
[System.UInt32]
$RecipientLimitInternalPerHour,

[Parameter()]
[System.String]
[System.UInt32]
$RecipientLimitPerDay,

[Parameter()]
[System.String]
[System.UInt32]
$RecipientLimitExternalPerHour,

[Parameter()]
Expand Down Expand Up @@ -337,15 +337,15 @@ function Test-TargetResource
$NotifyOutboundSpam = $true,

[Parameter()]
[System.String]
[System.UInt32]
$RecipientLimitInternalPerHour,

[Parameter()]
[System.String]
[System.UInt32]
$RecipientLimitPerDay,

[Parameter()]
[System.String]
[System.UInt32]
$RecipientLimitExternalPerHour,

[Parameter()]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ class MSFT_EXOHostedOutboundSpamFilterPolicy : OMI_BaseResource
[Write, Description("The BccSuspiciousOutboundMail parameter enables or disables adding recipients to the Bcc field of outgoing spam messages. Valid input for this parameter is $true or $false. The default value is $false. You specify the additional recipients using the BccSuspiciousOutboundAdditionalRecipients parameter.")] Boolean BccSuspiciousOutboundMail;
[Write, Description("The NotifyOutboundSpam parameter enables or disables sending notification messages to administrators when an outgoing message is determined to be spam. Valid input for this parameter is $true or $false. The default value is $false. You specify the administrators to notify by using the NotifyOutboundSpamRecipients parameter.")] Boolean NotifyOutboundSpam;
[Write, Description("The NotifyOutboundSpamRecipients parameter specifies the administrators to notify when an outgoing message is determined to be spam. Valid input for this parameter is an email address. Separate multiple email addresses with commas.")] String NotifyOutboundSpamRecipients[];
[Write, Description("The RecipientLimitInternalPerHour parameter specifies the maximum number of internal recipients that a user can send to within an hour. A valid value is 0 to 10000. The default value is 0, which means the service defaults are used.")] String RecipientLimitInternalPerHour;
[Write, Description("The RecipientLimitPerDay parameter specifies the maximum number of recipients that a user can send to within a day. A valid value is 0 to 10000. The default value is 0, which means the service defaults are used.")] String RecipientLimitPerDay;
[Write, Description("The RecipientLimitExternalPerHour parameter specifies the maximum number of external recipients that a user can send to within an hour. A valid value is 0 to 10000. The default value is 0, which means the service defaults are used.")] String RecipientLimitExternalPerHour;
[Write, Description("The RecipientLimitInternalPerHour parameter specifies the maximum number of internal recipients that a user can send to within an hour. A valid value is 0 to 10000. The default value is 0, which means the service defaults are used.")] UInt32 RecipientLimitInternalPerHour;
[Write, Description("The RecipientLimitPerDay parameter specifies the maximum number of recipients that a user can send to within a day. A valid value is 0 to 10000. The default value is 0, which means the service defaults are used.")] UInt32 RecipientLimitPerDay;
[Write, Description("The RecipientLimitExternalPerHour parameter specifies the maximum number of external recipients that a user can send to within an hour. A valid value is 0 to 10000. The default value is 0, which means the service defaults are used.")] UInt32 RecipientLimitExternalPerHour;
[Write, Description("The ActionWhenThresholdReached parameter specifies the action to take when any of the limits specified in the policy are reached. Valid values are: Alert, BlockUser, BlockUserForToday. BlockUserForToday is the default value.")] String ActionWhenThresholdReached;
[Write, Description("The AutoForwardingMode specifies how the policy controls automatic email forwarding to outbound recipients. Valid values are: Automatic, On, Off.")] String AutoForwardingMode;
[Write, Description("Specify if this policy should exist or not."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ Configuration Example
)
Import-DscResource -ModuleName Microsoft365DSC

$Domain = $Credscredential.Username.Split('@')[1]
node localhost
{
EXODistributionGroup 'DemoDG'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ Configuration Example
)
Import-DscResource -ModuleName Microsoft365DSC

$Domain = $Credscredential.Username.Split('@')[1]
node localhost
{
EXOEmailAddressPolicy 'ConfigureEmailAddressPolicy'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ Configuration Example
BccSuspiciousOutboundMail = $False
NotifyOutboundSpam = $False
NotifyOutboundSpamRecipients = @()
RecipientLimitExternalPerHour = 0
RecipientLimitInternalPerHour = 0
RecipientLimitPerDay = 0
#RecipientLimitExternalPerHour = 0
#RecipientLimitInternalPerHour = 0
#RecipientLimitPerDay = 0
Ensure = "Present"
ApplicationId = $ApplicationId
TenantId = $TenantId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ Configuration Example
BccSuspiciousOutboundMail = $False
NotifyOutboundSpam = $False
NotifyOutboundSpamRecipients = @()
RecipientLimitExternalPerHour = 0
RecipientLimitInternalPerHour = 1 # Updated Property
RecipientLimitPerDay = 0
#RecipientLimitExternalPerHour = 0
#RecipientLimitInternalPerHour = 1 # Updated Property
#RecipientLimitPerDay = 0
Ensure = "Present"
ApplicationId = $ApplicationId
TenantId = $TenantId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ Configuration Example

Import-DscResource -ModuleName Microsoft365DSC

$Domain = $Credscredential.Username.Split('@')[1]
node localhost
{
EXOHostedOutboundSpamFilterRule 'ConfigureHostedOutboundSpamFilterRule'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ Configuration Example
)
Import-DscResource -ModuleName Microsoft365DSC

$Domain = $Credscredential.Username.Split('@')[1]
node localhost
{
EXOMailContact 'TestMailContact'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ Configuration Example
)
Import-DscResource -ModuleName Microsoft365DSC

$Domain = $Credscredential.Username.Split('@')[1]
node localhost
{
EXOMailContact 'TestMailContact'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ Configuration Example
)
Import-DscResource -ModuleName Microsoft365DSC

$Domain = $Credscredential.Username.Split('@')[1]
node localhost
{
EXOManagementRole 'ConfigureManagementRole'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ Configuration Example
)
Import-DscResource -ModuleName Microsoft365DSC

$Domain = $Credscredential.Username.Split('@')[1]
node localhost
{
EXOManagementRoleAssignment 'AssignManagementRole'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ Configuration Example
)
Import-DscResource -ModuleName Microsoft365DSC

$Domain = $Credscredential.Username.Split('@')[1]
node localhost
{
EXOManagementRoleAssignment 'AssignManagementRole'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ Configuration Example
)
Import-DscResource -ModuleName Microsoft365DSC

$Domain = $Credscredential.Username.Split('@')[1]
node localhost
{
EXOManagementRoleAssignment 'AssignManagementRole'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ Configuration Example
[System.String]
$CertificateThumbprint
)
$OrganizationName = $Credscredential.UserName.Split('@')[1]
Import-DscResource -ModuleName Microsoft365DSC

node localhost
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@ Configuration Example
[System.String]
$CertificateThumbprint
)
$OrganizationName = $Credscredential.UserName.Split('@')[1]
Import-DscResource -ModuleName Microsoft365DSC

$Domain = $Credscredential.Username.Split('@')[1]
node localhost
{
EXOQuarantinePolicy 'ConfigureQuarantinePolicy'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@ Configuration Example
[System.String]
$CertificateThumbprint
)
$OrganizationName = $Credscredential.UserName.Split('@')[1]
Import-DscResource -ModuleName Microsoft365DSC

$Domain = $Credscredential.Username.Split('@')[1]
node localhost
{
EXOQuarantinePolicy 'ConfigureQuarantinePolicy'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ Configuration Example
)
Import-DscResource -ModuleName Microsoft365DSC

$Domain = $Credscredential.Username.Split('@')[1]
node localhost
{
EXOSafeAttachmentPolicy 'ConfigureSafeAttachmentPolicy'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ Configuration Example
)
Import-DscResource -ModuleName Microsoft365DSC

$Domain = $Credscredential.Username.Split('@')[1]
node localhost
{
EXOSafeAttachmentPolicy 'ConfigureSafeAttachmentPolicy'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ Configuration Example
)
Import-DscResource -ModuleName Microsoft365DSC

$Domain = $Credscredential.Username.Split('@')[1]
node localhost
{
EXOSafeAttachmentRule 'ConfigureSafeAttachmentRule'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ Configuration Example
)
Import-DscResource -ModuleName Microsoft365DSC

$Domain = $Credscredential.Username.Split('@')[1]
node localhost
{
EXOSharedMailbox 'SharedMailbox'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ Configuration Example
)
Import-DscResource -ModuleName Microsoft365DSC

$Domain = $Credscredential.Username.Split('@')[1]
node localhost
{
EXOTransportRule 'ConfigureTransportRule'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ Configuration Example
)
Import-DscResource -ModuleName Microsoft365DSC

$Domain = $Credscredential.Username.Split('@')[1]
node localhost
{
EXOTransportRule 'ConfigureTransportRule'
Expand Down
6 changes: 3 additions & 3 deletions Modules/Microsoft365DSC/SchemaDefinition.json
Original file line number Diff line number Diff line change
Expand Up @@ -8623,17 +8623,17 @@
"Option": "Write"
},
{
"CIMType": "String",
"CIMType": "UInt32",
"Name": "RecipientLimitInternalPerHour",
"Option": "Write"
},
{
"CIMType": "String",
"CIMType": "UInt32",
"Name": "RecipientLimitPerDay",
"Option": "Write"
},
{
"CIMType": "String",
"CIMType": "UInt32",
"Name": "RecipientLimitExternalPerHour",
"Option": "Write"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,9 +326,9 @@
BccSuspiciousOutboundMail = $False
NotifyOutboundSpam = $False
NotifyOutboundSpamRecipients = @()
RecipientLimitExternalPerHour = 0
RecipientLimitInternalPerHour = 0
RecipientLimitPerDay = 0
#RecipientLimitExternalPerHour = 0
#RecipientLimitInternalPerHour = 0
#RecipientLimitPerDay = 0
Ensure = "Present"
ApplicationId = $ApplicationId
TenantId = $TenantId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -465,9 +465,9 @@
BccSuspiciousOutboundMail = $False
NotifyOutboundSpam = $False
NotifyOutboundSpamRecipients = @()
RecipientLimitExternalPerHour = 0
RecipientLimitInternalPerHour = 1 # Updated Property
RecipientLimitPerDay = 0
#RecipientLimitExternalPerHour = 0
#RecipientLimitInternalPerHour = 1 # Updated Property
#RecipientLimitPerDay = 0
Ensure = "Present"
ApplicationId = $ApplicationId
TenantId = $TenantId
Expand Down
4 changes: 4 additions & 0 deletions Tests/QA/Microsoft365DSC.Examples.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,10 @@ Describe -Name 'Successfully compile examples' {
#>
$exampleParameters.Add($parameterName, ('1' -as $parameterType))
}
elseif ($parameterName -eq 'TenantId')
{
$exampleParameters.Add('TenantId', (New-Guid).ToString())
}
}
}

Expand Down
1 change: 0 additions & 1 deletion docs/docs/resources/exchange/EXODistributionGroup.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ Configuration Example
)
Import-DscResource -ModuleName Microsoft365DSC
$Domain = $Credscredential.Username.Split('@')[1]
node localhost
{
EXODistributionGroup 'DemoDG'
Expand Down
1 change: 0 additions & 1 deletion docs/docs/resources/exchange/EXOEmailAddressPolicy.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ Configuration Example
)
Import-DscResource -ModuleName Microsoft365DSC
$Domain = $Credscredential.Username.Split('@')[1]
node localhost
{
EXOEmailAddressPolicy 'ConfigureEmailAddressPolicy'
Expand Down
Loading

0 comments on commit fa8c008

Please sign in to comment.