From 537a0edc3babdd46c0ec9760d88699605b8cf6a3 Mon Sep 17 00:00:00 2001 From: Anthony Watherston Date: Mon, 24 Feb 2025 13:04:17 +1100 Subject: [PATCH] createObject edge case and metadata ordering. (#890) Co-authored-by: Anthony Watherston --- Scripts/Helpers/Confirm-ParametersUsageMatches.ps1 | 11 +++++++---- Scripts/Helpers/ConvertTo-HashTable.ps1 | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Scripts/Helpers/Confirm-ParametersUsageMatches.ps1 b/Scripts/Helpers/Confirm-ParametersUsageMatches.ps1 index 5b00ab71..9aebf719 100644 --- a/Scripts/Helpers/Confirm-ParametersUsageMatches.ps1 +++ b/Scripts/Helpers/Confirm-ParametersUsageMatches.ps1 @@ -33,15 +33,18 @@ function Confirm-ParametersUsageMatches { $definedParameter = $definedParameters.$definedParameterName } - $existingParameterValue = $existingParameter - if ($null -ne $existingParameterValue.value) { + if ($existingParameter -is [System.Collections.Hashtable]) { $existingParameterValue = $existingParameter.value } + else { + $existingParameterValue = $existingParameter + } + $definedParameterValue = $definedParameter - if ($null -ne $definedParameterValue.value) { + if (($null -ne $definedParameterValue.value) -and (-not($uniqueKeys -contains "AzurePatchRingmaintenanceConfigurationResourceId"))) { $definedParameterValue = $definedParameter.value } - + if (!(Confirm-ObjectValueEqualityDeep $existingParameterValue $definedParameterValue)) { return $false } diff --git a/Scripts/Helpers/ConvertTo-HashTable.ps1 b/Scripts/Helpers/ConvertTo-HashTable.ps1 index ca687a96..be959019 100644 --- a/Scripts/Helpers/ConvertTo-HashTable.ps1 +++ b/Scripts/Helpers/ConvertTo-HashTable.ps1 @@ -6,7 +6,7 @@ function ConvertTo-HashTable { $InputObject = $null ) - [hashtable] $hashTable = @{} + [hashtable] $hashTable = [ordered]@{} if ($null -ne $InputObject) { if ($InputObject -is [System.Collections.IDictionary]) { if ($InputObject -is [hashtable]) {