Skip to content

Commit

Permalink
Fixed remove exemption (#227)
Browse files Browse the repository at this point in the history
  • Loading branch information
anwather authored May 3, 2023
1 parent 7c216ab commit f6db5a9
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions Scripts/Deploy/Deploy-PolicyPlan.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -375,18 +375,15 @@ else {
}
}

$exemptions = (ConvertTo-HashTable $plan.exemptions.update)
$exemptions = (ConvertTo-HashTable $plan.exemptions.delete)
if ($exemptions.psbase.Count -gt 0) {
Write-Information ""
Write-Information "==================================================================================================="
Write-Information "Update Exemptions ($($exemptions.psbase.Count))"
Write-Information "Delete Exemptions ($($exemptions.psbase.Count))"
Write-Information "---------------------------------------------------------------------------------------------------"
foreach ($exemptionId in $exemptions.Keys) {
$exemption = $exemptions[$exemptionId]
$splatTransform = $exemption.splatTransform
$filteredExemption = $exemption | Get-FilteredHashTable -splatTransform $splatTransform
Write-Information $exemption.displayName
$null = Set-AzPolicyExemption @filteredExemption
$null = Remove-AzPolicyExemption -Id $exemptionId -Force
}
}

Expand Down

0 comments on commit f6db5a9

Please sign in to comment.