Skip to content

Check for ScheduledPurgeDate before logging in Resource Helper Script#15475

Open
msalaman wants to merge 3 commits intomainfrom
masalama/fixPurgeDateBug
Open

Check for ScheduledPurgeDate before logging in Resource Helper Script#15475
msalaman wants to merge 3 commits intomainfrom
masalama/fixPurgeDateBug

Conversation

@msalaman
Copy link
Copy Markdown
Contributor

@msalaman msalaman commented May 4, 2026

Currently clean up script is failing in scenario where are a resource doesn't have a "ScheduledPurgeDate". Current logging doesn't allow us to even see the name of said resource. This change updates logging so resource name is logged separately before scheduledpurgedate, and such situation where there is no purge date is handled

Copilot AI review requested due to automatic review settings May 4, 2026 21:02
@msalaman msalaman requested a review from a team as a code owner May 4, 2026 21:02
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the common resource cleanup helper (Remove-PurgeableResources) to avoid failures when deleted Key Vault / Managed HSM objects don’t expose ScheduledPurgeDate, while still emitting useful verbose logging about which resource is being skipped due to purge protection.

Changes:

  • Build the purge-protection verbose message in two steps (resource name + optional purge date suffix).
  • Guard access to ScheduledPurgeDate by checking the property exists and is non-empty before logging it.
  • Apply the same handling for both Key Vault and Managed HSM resource types.
Show a summary per file
File Description
eng/common/scripts/Helpers/Resource-Helpers.ps1 Makes purge-protection verbose logging resilient to missing ScheduledPurgeDate while preserving resource identification in logs.

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 0

@azure-sdk
Copy link
Copy Markdown
Collaborator

The following pipelines have been queued for testing:
java - template
java - template - tests
js - template
net - template
net - template - tests
python - template
python - template - tests
You can sign off on the approval gate to test the release stage of each pipeline.
See eng/common workflow

Comment thread eng/common/scripts/Helpers/Resource-Helpers.ps1
@azure-sdk
Copy link
Copy Markdown
Collaborator

The following pipelines have been queued for testing:
java - template
java - template - tests
js - template
net - template
net - template - tests
python - template
python - template - tests
You can sign off on the approval gate to test the release stage of each pipeline.
See eng/common workflow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants