Skip to content

Commit

Permalink
Merge pull request #4659 from ricmestre/fix4658
Browse files Browse the repository at this point in the history
SPOTenantCdnPolicy: Fix couple of issues
  • Loading branch information
NikCharlebois committed May 14, 2024
2 parents 821cc68 + fd0dc9b commit 8890978
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 26 deletions.
24 changes: 15 additions & 9 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
* Added support for parameter NewUnifiedGroupWritebackDefault
* EXOManagementRoleEntry
* Initial Rrelease
* SCAutoSensitivityLabelPolicy
* Fix incorrect mandatory Credential parameter in Set and Test methods
FIXES [#4283](https://github.com/microsoft/Microsoft365DSC/issues/4283)
* IntuneAntivirusPolicyWindows10SettingCatalog
* Add missing properties from templates
* Update setting handling so that the value is reverted to default when unset
Expand All @@ -19,26 +16,35 @@
* IntuneDeviceConfigurationDefenderForEndpointOnboardingPolicyWindows10
* Fixed a creation and update issue when the exported policy contains a
onboarding blob and the tenant is connected to Defender for Endpoint Service.
<<<<<<< fix4653
* TeamsMeetingPolicy
* Fix creation and set of resource when cloud recording is set to false (off)
FIXES [#4653](https://github.com/microsoft/Microsoft365DSC/issues/4653)
=======
* SCAutoSensitivityLabelPolicy
* Fix incorrect mandatory Credential parameter in Set and Test methods
FIXES [#4283](https://github.com/microsoft/Microsoft365DSC/issues/4283)
* SPOSharingSettings
* Remove properties from being tested in certain conditions
FIXES [#4649](https://github.com/microsoft/Microsoft365DSC/issues/4649)
* Changed logic to retrieve my site for sovereign clouds.
* SPOTenantCdnPolicy
* Fixed an issue when both IncludeFileExtensions and
ExcludeRestrictedSiteClassifications needed to be changed but the latter got
the value of the former instead of the correct one
FIXES [#4658](https://github.com/microsoft/Microsoft365DSC/issues/4658)
* TeamsMeetingPolicy
* Fix creation and set of resource when cloud recording is set to false (off)
FIXES [#4653](https://github.com/microsoft/Microsoft365DSC/issues/4653)
* TeamsGroupPolicyAssignment
* Add missing policy type TeamsVerticalPackagePolicy
FIXES [#4647](https://github.com/microsoft/Microsoft365DSC/issues/4647)
* TeamsUpdateManagementPolicy
* Remove unnecessary parameters from PSBoundParameters such as authentication
methods, Ensure and Verbose by calling Remove-M365DSCAuthenticationParameter
FIXES [#4651](https://github.com/microsoft/Microsoft365DSC/issues/4651)
>>>>>>> Dev
* M365DSCUtil
* Fixed an issue where one could not pass empty arrays to the
`Compare-PSCustomObjectArrays` function.
* Fixed an issue with how the ResourceInstanceName was being assigned for
resource SPOTenantCdnPolicy by adding its primary key CDNType to the
heuristics
FIXES [#4658](https://github.com/microsoft/Microsoft365DSC/issues/4658)
* DEPENDENCIES
* Updated DSCParser to version 2.0.0.4.
* Updated Microsoft.Graph to version 2.19.0.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,26 +199,21 @@ function Set-TargetResource
{
Write-Verbose 'Found difference in IncludeFileExtensions'

$stringValue = ''
foreach ($entry in $IncludeFileExtensions.Split(','))
{
$stringValue += $entry + ','
}
$stringValue = $stringValue.Remove($stringValue.Length - 1, 1)
[String]$IncludeFileExtensions = [String[]]$IncludeFileExtensions -join ','
Set-PnPTenantCdnPolicy -CdnType $CDNType `
-PolicyType 'IncludeFileExtensions' `
-PolicyValue $stringValue
-PolicyValue $IncludeFileExtensions
}

if ($null -ne (Compare-Object -ReferenceObject $curPolicies.ExcludeRestrictedSiteClassifications `
-DifferenceObject $ExcludeRestrictedSiteClassifications))
{
Write-Verbose 'Found difference in ExcludeRestrictedSiteClassifications'


[String]$ExcludeRestrictedSiteClassifications = [String[]]$ExcludeRestrictedSiteClassifications -join ','
Set-PnPTenantCdnPolicy -CdnType $CDNType `
-PolicyType 'ExcludeRestrictedSiteClassifications' `
-PolicyValue $stringValue
-PolicyValue $ExcludeRestrictedSiteClassifications
}
}

Expand Down
6 changes: 4 additions & 2 deletions Modules/Microsoft365DSC/Modules/M365DSCUtil.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -437,12 +437,10 @@ function Compare-PSCustomObjectArrays
param
(
[Parameter(Mandatory = $true)]
[AllowEmptyCollection()]
[System.Object[]]
$DesiredValues,

[Parameter(Mandatory = $true)]
[AllowEmptyCollection()]
[System.Object[]]
$CurrentValues
)
Expand Down Expand Up @@ -3462,6 +3460,10 @@ function Get-M365DSCExportContentForResource
{
$primaryKey = $Results.Id
}
elseif ($Keys.Contains('CDNType'))
{
$primaryKey = $Results.CDNType
}

if ([String]::IsNullOrEmpty($primaryKey) -and `
-not $Keys.Contains('IsSingleInstance'))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture {
Mock -CommandName Get-PnPTenantCDNPolicies -MockWith {
return @{
CDNType = 'Public'
ExcludeRestrictedSiteClassifications = @('Secured')
IncludeFileExtensions = @('.php')
ExcludeRestrictedSiteClassifications = 'Secured'
IncludeFileExtensions = '.php'
}
}
}
Expand Down Expand Up @@ -87,8 +87,8 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture {
return @{
CDNType = 'Private'
ExcludeIfNoScriptDisabled = $false
ExcludeRestrictedSiteClassifications = @('Secured')
IncludeFileExtensions = @('.php')
ExcludeRestrictedSiteClassifications = 'Secured'
IncludeFileExtensions = '.php'
}
}
}
Expand Down Expand Up @@ -119,8 +119,8 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture {
return @{
CDNType = 'Public'
ExcludeIfNoScriptDisabled = $false
ExcludeRestrictedSiteClassifications = @('Secured')
IncludeFileExtensions = @('.php')
ExcludeRestrictedSiteClassifications = 'Secured'
IncludeFileExtensions = '.php'
}
}
}
Expand Down

0 comments on commit 8890978

Please sign in to comment.