You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$response=Invoke-AzRestMethod-Method POST -Path "/subscriptions/$subscriptionId/providers/Microsoft.KeyVault/locations/$($r.Location)/deletedManagedHSMs/$($r.Name)/purge?api-version=2021-04-01-preview"-ErrorAction Ignore
130
+
$response=Invoke-AzRestMethod-Method POST -Path "/subscriptions/$subscriptionId/providers/Microsoft.KeyVault/locations/$($($using:r).Location)/deletedManagedHSMs/$($($using:r).Name)/purge?api-version=2021-04-01-preview"-ErrorAction Ignore
129
131
if ($response.StatusCode-ge200-and$response.StatusCode-lt300) {
130
-
Write-Warning"Successfully requested that Managed HSM '$($r.Name)' be purged, but may take a few minutes before it is actually purged."
132
+
Write-Warning"Successfully requested that Managed HSM '$($($using:r).Name)' be purged, but may take a few minutes before it is actually purged."
131
133
} elseif ($response.Content) {
132
134
$content=$response.Content|ConvertFrom-Json
133
135
if ($content.error) {
134
136
$err=$content.error
135
-
Write-Warning"Failed to deleted Managed HSM '$($r.Name)': ($($err.code)) $($err.message)"
137
+
Write-Warning"Failed to deleted Managed HSM '$($($using:r).Name)': ($($err.code)) $($err.message)"
136
138
}
137
139
}
138
140
}
@@ -166,15 +168,10 @@ function Wait-PurgeableResource {
166
168
[switch] $PassThru
167
169
)
168
170
169
-
# We build a new AST to pass the `$Resource` as `$r`, which is the `foreach` variable declared in `Remove-PurgeableResources` above.
170
-
# This is done to make writing a purge script feel natural without having to worry about scope since `[ScriptBlock].GetNewClosure()`
171
-
# does not capture `$r` appropriately. If the variable name in the `foreach` above is changed, it must be changed here as well.
0 commit comments