Skip to content

Commit

Permalink
Do not try to purge keyvaults with purge protection
Browse files Browse the repository at this point in the history
  • Loading branch information
benbp authored and azure-sdk committed Nov 5, 2024
1 parent 3cb01e6 commit 80ef9d3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions eng/common/scripts/Helpers/Resource-Helpers.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ filter Remove-PurgeableResources {
switch ($r.AzsdkResourceType) {
'Key Vault' {
if ($r.EnablePurgeProtection) {
# We will try anyway but will ignore errors.
Write-Warning "Key Vault '$($r.VaultName)' has purge protection enabled and may not be purged until $($r.ScheduledPurgeDate)"
continue
}

# Use `-AsJob` to start a lightweight, cancellable job and pass to `Wait-PurgeableResoruceJob` for consistent behavior.
Expand All @@ -134,8 +134,8 @@ filter Remove-PurgeableResources {

'Managed HSM' {
if ($r.EnablePurgeProtection) {
# We will try anyway but will ignore errors.
Write-Warning "Managed HSM '$($r.Name)' has purge protection enabled and may not be purged until $($r.ScheduledPurgeDate)"
continue
}

# Use `GetNewClosure()` on the `-Action` ScriptBlock to make sure variables are captured.
Expand Down

0 comments on commit 80ef9d3

Please sign in to comment.