Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #2523 #2564

Merged
merged 3 commits into from
Nov 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

# UNRELEASED

* O365AdminAuditLogConfig
* Updated settings.json to include permissions.
FIXES [#2517](https://github.com/microsoft/Microsoft365DSC/issues/2517)
* O365OrgCustomizationSetting
* Updated settings.json to include permissions.
FIXES [#2517](https://github.com/microsoft/Microsoft365DSC/issues/2517)
* SCRetentionCompliancePolicy
* Fixes issue with the TeamsChannelLocation and TeamsChatsLocation parameters that were improperly returned by the Get- function.
FIXES [#2472](https://github.com/microsoft/Microsoft365DSC/issues/2472)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -401,88 +401,47 @@ function Set-TargetResource
Add-M365DSCTelemetryEvent -Data $data
#endregion


if ($RecipientFilter)
{
Write-Verbose -Message "You can't use RecipientFilter and precanned filters at the same time. All precanned filters will be ignored."
$NewAddressListParams = @{
Name = $Name
RecipientFilter = $RecipientFilter
Confirm = $false
}
}
else
{
$NewAddressListParams = @{
Name = $Name
ConditionalCompany = $ConditionalCompany
ConditionalCustomAttribute1 = $ConditionalCustomAttribute1
ConditionalCustomAttribute10 = $ConditionalCustomAttribute10
ConditionalCustomAttribute11 = $ConditionalCustomAttribute11
ConditionalCustomAttribute12 = $ConditionalCustomAttribute12
ConditionalCustomAttribute13 = $ConditionalCustomAttribute13
ConditionalCustomAttribute14 = $ConditionalCustomAttribute14
ConditionalCustomAttribute15 = $ConditionalCustomAttribute15
ConditionalCustomAttribute2 = $ConditionalCustomAttribute2
ConditionalCustomAttribute3 = $ConditionalCustomAttribute3
ConditionalCustomAttribute4 = $ConditionalCustomAttribute4
ConditionalCustomAttribute5 = $ConditionalCustomAttribute5
ConditionalCustomAttribute6 = $ConditionalCustomAttribute6
ConditionalCustomAttribute7 = $ConditionalCustomAttribute7
ConditionalCustomAttribute8 = $ConditionalCustomAttribute8
ConditionalCustomAttribute9 = $ConditionalCustomAttribute9
ConditionalDepartment = $ConditionalDepartment
ConditionalStateOrProvince = $ConditionalStateOrProvince
DisplayName = $DisplayName
IncludedRecipients = $IncludedRecipients
Confirm = $false
}
}

if ($RecipientFilter)
{
Write-Verbose -Message "You can't use RecipientFilter and precanned filters at the same time. All precanned filters will be ignored."
$SetAddressListParams = @{
Identity = $Name
Name = $Name
RecipientFilter = $RecipientFilter
Confirm = $false
}
}
else
{
$SetAddressListParams = @{
Identity = $Name
Name = $Name
ConditionalCompany = $ConditionalCompany
ConditionalCustomAttribute1 = $ConditionalCustomAttribute1
ConditionalCustomAttribute10 = $ConditionalCustomAttribute10
ConditionalCustomAttribute11 = $ConditionalCustomAttribute11
ConditionalCustomAttribute12 = $ConditionalCustomAttribute12
ConditionalCustomAttribute13 = $ConditionalCustomAttribute13
ConditionalCustomAttribute14 = $ConditionalCustomAttribute14
ConditionalCustomAttribute15 = $ConditionalCustomAttribute15
ConditionalCustomAttribute2 = $ConditionalCustomAttribute2
ConditionalCustomAttribute3 = $ConditionalCustomAttribute3
ConditionalCustomAttribute4 = $ConditionalCustomAttribute4
ConditionalCustomAttribute5 = $ConditionalCustomAttribute5
ConditionalCustomAttribute6 = $ConditionalCustomAttribute6
ConditionalCustomAttribute7 = $ConditionalCustomAttribute7
ConditionalCustomAttribute8 = $ConditionalCustomAttribute8
ConditionalCustomAttribute9 = $ConditionalCustomAttribute9
ConditionalDepartment = $ConditionalDepartment
ConditionalStateOrProvince = $ConditionalStateOrProvince
DisplayName = $DisplayName
IncludedRecipients = $IncludedRecipients
RecipientFilter = $RecipientFilter
Confirm = $false
}
}

#Address List doesn't exist but it should
if ($Ensure -eq 'Present' -and $currentAddressListConfig.Ensure -eq 'Absent')
{
Write-Verbose -Message "The Address List '$($Name)' does not exist but it should. Creating Address List."

if ($RecipientFilter)
{
Write-Verbose -Message "You can't use RecipientFilter and precanned filters at the same time. All precanned filters will be ignored."
$NewAddressListParams = @{
Name = $Name
RecipientFilter = $RecipientFilter
Confirm = $false
}
}
else
{
$NewAddressListParams = @{
Name = $Name
ConditionalCompany = $ConditionalCompany
ConditionalCustomAttribute1 = $ConditionalCustomAttribute1
ConditionalCustomAttribute10 = $ConditionalCustomAttribute10
ConditionalCustomAttribute11 = $ConditionalCustomAttribute11
ConditionalCustomAttribute12 = $ConditionalCustomAttribute12
ConditionalCustomAttribute13 = $ConditionalCustomAttribute13
ConditionalCustomAttribute14 = $ConditionalCustomAttribute14
ConditionalCustomAttribute15 = $ConditionalCustomAttribute15
ConditionalCustomAttribute2 = $ConditionalCustomAttribute2
ConditionalCustomAttribute3 = $ConditionalCustomAttribute3
ConditionalCustomAttribute4 = $ConditionalCustomAttribute4
ConditionalCustomAttribute5 = $ConditionalCustomAttribute5
ConditionalCustomAttribute6 = $ConditionalCustomAttribute6
ConditionalCustomAttribute7 = $ConditionalCustomAttribute7
ConditionalCustomAttribute8 = $ConditionalCustomAttribute8
ConditionalCustomAttribute9 = $ConditionalCustomAttribute9
ConditionalDepartment = $ConditionalDepartment
ConditionalStateOrProvince = $ConditionalStateOrProvince
DisplayName = $DisplayName
IncludedRecipients = $IncludedRecipients
Confirm = $false
}
}
New-AddressList @NewAddressListParams
}
#Address List exists but shouldn't
Expand All @@ -494,6 +453,45 @@ function Set-TargetResource
elseif ($Ensure -eq 'Present' -and $currentAddressListConfig.Ensure -eq 'Present')
{
Write-Verbose -Message "Address List '$($Name)' already exists. Updating settings"
if ($RecipientFilter)
{
Write-Verbose -Message "You can't use RecipientFilter and precanned filters at the same time. All precanned filters will be ignored."
$SetAddressListParams = @{
Identity = $Name
Name = $Name
RecipientFilter = $RecipientFilter
Confirm = $false
}
}
else
{
$SetAddressListParams = @{
Identity = $Name
Name = $Name
ConditionalCompany = $ConditionalCompany
ConditionalCustomAttribute1 = $ConditionalCustomAttribute1
ConditionalCustomAttribute10 = $ConditionalCustomAttribute10
ConditionalCustomAttribute11 = $ConditionalCustomAttribute11
ConditionalCustomAttribute12 = $ConditionalCustomAttribute12
ConditionalCustomAttribute13 = $ConditionalCustomAttribute13
ConditionalCustomAttribute14 = $ConditionalCustomAttribute14
ConditionalCustomAttribute15 = $ConditionalCustomAttribute15
ConditionalCustomAttribute2 = $ConditionalCustomAttribute2
ConditionalCustomAttribute3 = $ConditionalCustomAttribute3
ConditionalCustomAttribute4 = $ConditionalCustomAttribute4
ConditionalCustomAttribute5 = $ConditionalCustomAttribute5
ConditionalCustomAttribute6 = $ConditionalCustomAttribute6
ConditionalCustomAttribute7 = $ConditionalCustomAttribute7
ConditionalCustomAttribute8 = $ConditionalCustomAttribute8
ConditionalCustomAttribute9 = $ConditionalCustomAttribute9
ConditionalDepartment = $ConditionalDepartment
ConditionalStateOrProvince = $ConditionalStateOrProvince
DisplayName = $DisplayName
IncludedRecipients = $IncludedRecipients
RecipientFilter = $RecipientFilter
Confirm = $false
}
}
Write-Verbose -Message "Setting Address List '$($Name)' with values: $(Convert-M365DscHashtableToString -Hashtable $SetAddressListParams)"
Set-AddressList @SetAddressListParams
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
"read": [],
"update": []
}
},
"exchange": {
"requiredroles": [
"Audit Logs"
],
"requiredrolegroups": []
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
"read": [],
"update": []
}
},
"exchange": {
"requiredroles": [
"Organization Configuration"
],
"requiredrolegroups": []
}
}
}
6 changes: 5 additions & 1 deletion Modules/Microsoft365DSC/Modules/M365DSCUtil.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -3243,10 +3243,14 @@ function Get-M365DSCWorkloadsListFromResourceNames
}
'O3'
{
if (-not $workloads.Contains('MicrosoftGraph'))
if (-not $workloads.Contains('MicrosoftGraph') -and $resource -eq 'O365Group')
{
$workloads += 'MicrosoftGraph'
}
elseif(-not $workloads.Contains('ExchangeOnline'))
{
$workloads += 'ExchangeOnline'
}
}
'OD'
{
Expand Down