-
Notifications
You must be signed in to change notification settings - Fork 183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Filter out future purge dates resources #1910
Conversation
/azp run automation - live-test-resource-cleanup |
Azure Pipelines successfully started running 1 pipeline(s). |
413e69f
to
6a49169
Compare
/azp run automation - live-test-resource-cleanup |
Azure Pipelines successfully started running 1 pipeline(s). |
@heaths I'm merging this for now to give the cleanup automation a change to finish as it keeps timing out currently and even locally I seem to keep hitting hangs or timeouts on certain resources. If you know of a better way to filter what we can and cannot delete yet let me know. |
$purgeableResources = Get-PurgeableResources | ||
$allPurgeCount = $purgeableResources.Count | ||
|
||
# Filter down to the ones that we can actually perge. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"purge"
/cc @weshaggard
$allPurgeCount = $purgeableResources.Count | ||
|
||
# Filter down to the ones that we can actually perge. | ||
$purgeableResources = $purgeableResources.Where({ $purgeDate = $_.ScheduledPurgeDate -as [DateTime]; (!$purgeDate -or $now -gt $purgeDate) }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is now how you filter them. You need to check EnableSoftDelete. You've also not purged the vaults early enough. The default is 90d, so you're effectively leaving hundreds of vaults un-purged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no point in purging vaults in the future. Once the purge date is hit, they are purged automatically.
That's not why some fail to delete. The ones that fail to delete is because EnableSoftDelete is null or false. As I explained in discussions with my PR, the default for EnableSoftDelete was Vaults and managed HSMs are automatically deleted on the purge dates. That's what that property is for. By not deleting vaults and managed HSMs until after their purge date, you've effectively obviated the whole point of this clean-up exercise. |
Reverts #1910. Vaults and managed HSMs are automatically purged on their purge date. The point was to purge them daily to preserve capacity. The default purge date is +90 days.
Reverts #1910. Vaults and managed HSMs are automatically purged on their purge date. The point was to purge them daily to preserve capacity. The default purge date is +90 days.
Most (>8k) of the deleted key vaults have a future purge date and we fail to delete them and we end up timing out so I'm filtering so that we only attempt to delete ones with past due purge dates.