Skip to content

Commit

Permalink
Merge pull request #3893 from ricmestre/Dev
Browse files Browse the repository at this point in the history
Remove Id from PSBoundParameters in Test-TargetResource
  • Loading branch information
ykuijs authored Nov 29, 2023
2 parents f44ba30 + f99e096 commit ed9cf9c
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 89 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@
* Fixes export if Assignments is set on existing policies
FIXES [3913](https://github.com/microsoft/Microsoft365DSC/issues/3913)
* Add groupDisplayName to Assignments embedded instance
* IntuneDeviceConfigurationDeliveryOptimizationPolicyWindows10,
IntuneDeviceConfigurationHealthMonitoringConfigurationPolicyWindows10,
IntuneDeviceConfigurationIdentityProtectionPolicyWindows10,
IntuneDeviceConfigurationEndpointProtectionPolicyWindows10,
IntuneDeviceEnrollmentStatusPageWindows10,
IntuneWindowsAutopilotDeploymentProfileAzureADHybridJoined,
IntuneWindowsAutopilotDeploymentProfileAzureADJoined
* Removed Id and all authentication parameters from PSBoundParameters in Test-TargetResource
FIXES [#3888](https://github.com/microsoft/Microsoft365DSC/issues/3888)
* DEPENDENCIES
* Updated DSCParser to version 1.4.0.1.
* Updated Microsoft.Graph to version 2.10.0.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -459,15 +459,7 @@ function Set-TargetResource
#endregion

$currentInstance = Get-TargetResource @PSBoundParameters

$PSBoundParameters.Remove('Ensure') | Out-Null
$PSBoundParameters.Remove('Credential') | Out-Null
$PSBoundParameters.Remove('ApplicationId') | Out-Null
$PSBoundParameters.Remove('ApplicationSecret') | Out-Null
$PSBoundParameters.Remove('TenantId') | Out-Null
$PSBoundParameters.Remove('CertificateThumbprint') | Out-Null
$PSBoundParameters.Remove('ManagedIdentity') | Out-Null
$PSBoundParameters.Remove('Verbose') | Out-Null
$PSBoundParameters = Remove-M365DSCAuthenticationParameter -BoundParameters $PSBoundParameters

if ($Ensure -eq 'Present' -and $currentInstance.Ensure -eq 'Absent')
{
Expand Down Expand Up @@ -690,6 +682,8 @@ function Test-TargetResource

$CurrentValues = Get-TargetResource @PSBoundParameters
$ValuesToCheck = ([Hashtable]$PSBoundParameters).clone()
$ValuesToCheck = Remove-M365DSCAuthenticationParameter -BoundParameters $ValuesToCheck
$ValuesToCheck.Remove('Id') | Out-Null

if ($CurrentValues.Ensure -ne $PSBoundParameters.Ensure)
{
Expand Down Expand Up @@ -722,11 +716,6 @@ function Test-TargetResource
}
}

$ValuesToCheck.Remove('Credential') | Out-Null
$ValuesToCheck.Remove('ApplicationId') | Out-Null
$ValuesToCheck.Remove('TenantId') | Out-Null
$ValuesToCheck.Remove('ApplicationSecret') | Out-Null

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3685,15 +3685,7 @@ function Set-TargetResource
#endregion

$currentInstance = Get-TargetResource @PSBoundParameters

$PSBoundParameters.Remove('Ensure') | Out-Null
$PSBoundParameters.Remove('Credential') | Out-Null
$PSBoundParameters.Remove('ApplicationId') | Out-Null
$PSBoundParameters.Remove('ApplicationSecret') | Out-Null
$PSBoundParameters.Remove('TenantId') | Out-Null
$PSBoundParameters.Remove('CertificateThumbprint') | Out-Null
$PSBoundParameters.Remove('ManagedIdentity') | Out-Null
$PSBoundParameters.Remove('Verbose') | Out-Null
$PSBoundParameters = Remove-M365DSCAuthenticationParameter -BoundParameters $PSBoundParameters

if ($Ensure -eq 'Present' -and $currentInstance.Ensure -eq 'Absent')
{
Expand Down Expand Up @@ -4810,6 +4802,8 @@ function Test-TargetResource

$CurrentValues = Get-TargetResource @PSBoundParameters
$ValuesToCheck = ([Hashtable]$PSBoundParameters).clone()
$ValuesToCheck = Remove-M365DSCAuthenticationParameter -BoundParameters $ValuesToCheck
$ValuesToCheck.Remove('Id') | Out-Null

if ($CurrentValues.Ensure -ne $PSBoundParameters.Ensure)
{
Expand Down Expand Up @@ -4842,12 +4836,6 @@ function Test-TargetResource
}
}

$ValuesToCheck.Remove('Id') | Out-Null
$ValuesToCheck.Remove('Credential') | Out-Null
$ValuesToCheck.Remove('ApplicationId') | Out-Null
$ValuesToCheck.Remove('TenantId') | Out-Null
$ValuesToCheck.Remove('ApplicationSecret') | Out-Null

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,15 +262,7 @@ function Set-TargetResource
#endregion

$currentInstance = Get-TargetResource @PSBoundParameters

$PSBoundParameters.Remove('Ensure') | Out-Null
$PSBoundParameters.Remove('Credential') | Out-Null
$PSBoundParameters.Remove('ApplicationId') | Out-Null
$PSBoundParameters.Remove('ApplicationSecret') | Out-Null
$PSBoundParameters.Remove('TenantId') | Out-Null
$PSBoundParameters.Remove('CertificateThumbprint') | Out-Null
$PSBoundParameters.Remove('ManagedIdentity') | Out-Null
$PSBoundParameters.Remove('Verbose') | Out-Null
$PSBoundParameters = Remove-M365DSCAuthenticationParameter -BoundParameters $PSBoundParameters

if ($Ensure -eq 'Present' -and $currentInstance.Ensure -eq 'Absent')
{
Expand Down Expand Up @@ -439,6 +431,8 @@ function Test-TargetResource

$CurrentValues = Get-TargetResource @PSBoundParameters
$ValuesToCheck = ([Hashtable]$PSBoundParameters).clone()
$ValuesToCheck = Remove-M365DSCAuthenticationParameter -BoundParameters $ValuesToCheck
$ValuesToCheck.Remove('Id') | Out-Null

if ($CurrentValues.Ensure -ne $PSBoundParameters.Ensure)
{
Expand Down Expand Up @@ -470,11 +464,6 @@ function Test-TargetResource
}
}

$ValuesToCheck.Remove('Credential') | Out-Null
$ValuesToCheck.Remove('ApplicationId') | Out-Null
$ValuesToCheck.Remove('TenantId') | Out-Null
$ValuesToCheck.Remove('ApplicationSecret') | Out-Null

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,15 +369,7 @@ function Set-TargetResource
#endregion

$currentInstance = Get-TargetResource @PSBoundParameters

$PSBoundParameters.Remove('Ensure') | Out-Null
$PSBoundParameters.Remove('Credential') | Out-Null
$PSBoundParameters.Remove('ApplicationId') | Out-Null
$PSBoundParameters.Remove('ApplicationSecret') | Out-Null
$PSBoundParameters.Remove('TenantId') | Out-Null
$PSBoundParameters.Remove('CertificateThumbprint') | Out-Null
$PSBoundParameters.Remove('ManagedIdentity') | Out-Null
$PSBoundParameters.Remove('Verbose') | Out-Null
$PSBoundParameters = Remove-M365DSCAuthenticationParameter -BoundParameters $PSBoundParameters

if ($Ensure -eq 'Present' -and $currentInstance.Ensure -eq 'Absent')
{
Expand Down Expand Up @@ -588,6 +580,8 @@ function Test-TargetResource

$CurrentValues = Get-TargetResource @PSBoundParameters
$ValuesToCheck = ([Hashtable]$PSBoundParameters).clone()
$ValuesToCheck = Remove-M365DSCAuthenticationParameter -BoundParameters $ValuesToCheck
$ValuesToCheck.Remove('Id') | Out-Null

if ($CurrentValues.Ensure -ne $PSBoundParameters.Ensure)
{
Expand Down Expand Up @@ -620,11 +614,6 @@ function Test-TargetResource
}
}

$ValuesToCheck.Remove('Credential') | Out-Null
$ValuesToCheck.Remove('ApplicationId') | Out-Null
$ValuesToCheck.Remove('TenantId') | Out-Null
$ValuesToCheck.Remove('ApplicationSecret') | Out-Null

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -334,15 +334,7 @@ function Set-TargetResource
#endregion

$currentInstance = Get-TargetResource @PSBoundParameters

$PSBoundParameters.Remove('Ensure') | Out-Null
$PSBoundParameters.Remove('Credential') | Out-Null
$PSBoundParameters.Remove('ApplicationId') | Out-Null
$PSBoundParameters.Remove('ApplicationSecret') | Out-Null
$PSBoundParameters.Remove('TenantId') | Out-Null
$PSBoundParameters.Remove('CertificateThumbprint') | Out-Null
$PSBoundParameters.Remove('ManagedIdentity') | Out-Null
$PSBoundParameters.Remove('Verbose') | Out-Null
$PSBoundParameters = Remove-M365DSCAuthenticationParameter -BoundParameters $PSBoundParameters

if ($Ensure -eq 'Present' -and $currentInstance.Ensure -eq 'Absent')
{
Expand Down Expand Up @@ -561,6 +553,8 @@ function Test-TargetResource
Write-Verbose -Message "Testing configuration of the Intune Device Enrollment Configuration for Windows10 with Id {$Id} and DisplayName {$DisplayName}"
$CurrentValues = Get-TargetResource @PSBoundParameters
$ValuesToCheck = ([Hashtable]$PSBoundParameters).clone()
$ValuesToCheck = Remove-M365DSCAuthenticationParameter -BoundParameters $ValuesToCheck
$ValuesToCheck.Remove('Id') | Out-Null

if ($CurrentValues.Ensure -ne $PSBoundParameters.Ensure)
{
Expand Down Expand Up @@ -592,11 +586,6 @@ function Test-TargetResource
}
}

$ValuesToCheck.Remove('Credential') | Out-Null
$ValuesToCheck.Remove('ApplicationId') | Out-Null
$ValuesToCheck.Remove('TenantId') | Out-Null
$ValuesToCheck.Remove('ApplicationSecret') | Out-Null

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,15 +322,7 @@ function Set-TargetResource
#endregion

$currentInstance = Get-TargetResource @PSBoundParameters

$PSBoundParameters.Remove('Ensure') | Out-Null
$PSBoundParameters.Remove('Credential') | Out-Null
$PSBoundParameters.Remove('ApplicationId') | Out-Null
$PSBoundParameters.Remove('ApplicationSecret') | Out-Null
$PSBoundParameters.Remove('TenantId') | Out-Null
$PSBoundParameters.Remove('CertificateThumbprint') | Out-Null
$PSBoundParameters.Remove('ManagedIdentity') | Out-Null
$PSBoundParameters.Remove('Verbose') | Out-Null
$PSBoundParameters = Remove-M365DSCAuthenticationParameter -BoundParameters $PSBoundParameters

if ($Ensure -eq 'Present' -and $currentInstance.Ensure -eq 'Absent')
{
Expand Down Expand Up @@ -546,6 +538,8 @@ function Test-TargetResource

$CurrentValues = Get-TargetResource @PSBoundParameters
$ValuesToCheck = ([Hashtable]$PSBoundParameters).clone()
$ValuesToCheck = Remove-M365DSCAuthenticationParameter -BoundParameters $ValuesToCheck
$ValuesToCheck.Remove('Id') | Out-Null

if ($CurrentValues.Ensure -ne $PSBoundParameters.Ensure)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,15 +320,7 @@ function Set-TargetResource
#endregion

$currentInstance = Get-TargetResource @PSBoundParameters

$PSBoundParameters.Remove('Ensure') | Out-Null
$PSBoundParameters.Remove('Credential') | Out-Null
$PSBoundParameters.Remove('ApplicationId') | Out-Null
$PSBoundParameters.Remove('ApplicationSecret') | Out-Null
$PSBoundParameters.Remove('TenantId') | Out-Null
$PSBoundParameters.Remove('CertificateThumbprint') | Out-Null
$PSBoundParameters.Remove('ManagedIdentity') | Out-Null
$PSBoundParameters.Remove('Verbose') | Out-Null
$PSBoundParameters = Remove-M365DSCAuthenticationParameter -BoundParameters $PSBoundParameters

if ($Ensure -eq 'Present' -and $currentInstance.Ensure -eq 'Absent')
{
Expand Down Expand Up @@ -543,6 +535,8 @@ function Test-TargetResource

$CurrentValues = Get-TargetResource @PSBoundParameters
$ValuesToCheck = ([Hashtable]$PSBoundParameters).clone()
$ValuesToCheck = Remove-M365DSCAuthenticationParameter -BoundParameters $ValuesToCheck
$ValuesToCheck.Remove('Id') | Out-Null

if ($CurrentValues.Ensure -ne $PSBoundParameters.Ensure)
{
Expand Down

0 comments on commit ed9cf9c

Please sign in to comment.