Skip to content

Commit

Permalink
Merge pull request #4815 from ricmestre/fix4814
Browse files Browse the repository at this point in the history
EXOCASMailboxPlan: Remove DisplayName from set parameters
  • Loading branch information
NikCharlebois authored Jul 3, 2024
2 parents 94fb3f2 + a6113d2 commit d1d1126
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 16 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

* EXOCASMailboxPlan
* Remove `DisplayName` from set parameters
FIXES [#4814](https://github.com/microsoft/Microsoft365DSC/issues/4814)
* EXODkimSigningConfig
* Add support for 2048 key size
FIXES [#4805](https://github.com/microsoft/Microsoft365DSC/issues/4805)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,24 +237,16 @@ function Set-TargetResource
$ConnectionMode = New-M365DSCConnection -Workload 'ExchangeOnline' `
-InboundParameters $PSBoundParameters

$CASMailboxPlanParams = [System.Collections.Hashtable]($PSBoundParameters)
$CASMailboxPlanParams.Remove('Ensure') | Out-Null
$CASMailboxPlanParams.Remove('Credential') | Out-Null
$CASMailboxPlanParams.Remove('ApplicationId') | Out-Null
$CASMailboxPlanParams.Remove('TenantId') | Out-Null
$CASMailboxPlanParams.Remove('CertificateThumbprint') | Out-Null
$CASMailboxPlanParams.Remove('CertificatePath') | Out-Null
$CASMailboxPlanParams.Remove('CertificatePassword') | Out-Null
$CASMailboxPlanParams.Remove('ManagedIdentity') | Out-Null
$CASMailboxPlanParams.Remove('AccessTokens') | Out-Null
$PSBoundParameters = Remove-M365DSCAuthenticationParameter -BoundParameters $PSBoundParameters
$PSBoundParameters.Remove('DisplayName') | Out-Null

$CASMailboxPlan = Get-CASMailboxPlan -Filter "Name -like '$($Identity.Split('-')[0])-*'"

if ($null -ne $CASMailboxPlan)
{
$CasMailboxPlanParams.Identity = $CASMailboxPlan.Identity
Write-Verbose -Message "Setting CASMailboxPlan $Identity with values: $(Convert-M365DscHashtableToString -Hashtable $CASMailboxPlanParams)"
Set-CASMailboxPlan @CASMailboxPlanParams
$PSBoundParameters.Identity = $CASMailboxPlan.Identity
Write-Verbose -Message "Setting CASMailboxPlan $Identity with values: $(Convert-M365DscHashtableToString -Hashtable $PSBoundParameters)"
Set-CASMailboxPlan @PSBoundParameters
}
else
{
Expand Down Expand Up @@ -344,13 +336,12 @@ function Test-TargetResource
Write-Verbose -Message "Testing configuration of CASMailboxPlan for $Identity"

$CurrentValues = Get-TargetResource @PSBoundParameters
$ValuesToCheck = ([Hashtable]$PSBoundParameters).Clone()
$ValuesToCheck = Remove-M365DSCAuthenticationParameter -BoundParameters $ValuesToCheck

Write-Verbose -Message "Current Values: $(Convert-M365DscHashtableToString -Hashtable $CurrentValues)"
Write-Verbose -Message "Target Values: $(Convert-M365DscHashtableToString -Hashtable $PSBoundParameters)"

$ValuesToCheck = $PSBoundParameters
$ValuesToCheck.Remove('Ensure') | Out-Null

$TestResult = Test-M365DSCParameterState -CurrentValues $CurrentValues `
-Source $($MyInvocation.MyCommand.Source) `
-DesiredValues $PSBoundParameters `
Expand Down

0 comments on commit d1d1126

Please sign in to comment.