diff --git a/src/public/Convert-SentinelARYamlToArm.ps1 b/src/public/Convert-SentinelARYamlToArm.ps1 index 1634e82..7b48e67 100644 --- a/src/public/Convert-SentinelARYamlToArm.ps1 +++ b/src/public/Convert-SentinelARYamlToArm.ps1 @@ -268,11 +268,21 @@ function Convert-SentinelARYamlToArm { $ARMTemplate.techniques = $ARMTemplate.techniques | Where-Object { Test-MITRETechnique $_ } } + # Remove duplicate techniques + if ($ARMTemplate.techniques) { + $ARMTemplate.techniques = $ARMTemplate.techniques | Sort-Object -Unique + } + # Remove any invalid or non-existent tactics from the tactics array if ($ARMTemplate.tactics) { $ARMTemplate.tactics = $ARMTemplate.tactics | Where-Object { Test-MITRETactic $_ } } + # Remove duplicate tactics + if ($ARMTemplate.tactics) { + $ARMTemplate.tactics = $ARMTemplate.tactics | Sort-Object -Unique + } + # Convert hashtable to JSON $JSON = $ARMTemplate | ConvertTo-Json -Depth 99 # Use ISO8601 format for timespan values