{backup} az backup Fix live testing using storage accounts and improve RG teardown#33749
{backup} az backup Fix live testing using storage accounts and improve RG teardown#33749zubairabid wants to merge 2 commits into
az backup Fix live testing using storage accounts and improve RG teardown#33749Conversation
… RG teardown The BCDR_StorageAccount_RequiredTags deny policy (management-group scope) blocks the untagged storage account created by the test preparer, and the GPv1 'Storage' kind is no longer allowed for new accounts. Add a self-contained StorageAccountPreparer that creates the account with the required tags (DisableLocalAuth=false, Reason, ETA, Owner) and kind StorageV2. Consolidate to a single custom ResourceGroupPreparer (subclass of the testsdk preparer) whose teardown clears any resource locks and retries on ScopeLocked, since Azure Backup releases the AFS storage-account CanNotDelete lock asynchronously. Remove the unused RGPreparer stopgap. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Validation for Azure CLI Full Test Starting...
Thanks for your contribution! |
|
Hi @zubairabid, |
|
Validation for Breaking Change Starting...
Thanks for your contribution! |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
Thank you for your contribution @zubairabid! We will review the pull request and get back to you soon. |
There was a problem hiding this comment.
Pull request overview
This PR updates the az backup command module’s scenario-test infrastructure to make live testing more reliable when tests need to create storage accounts (e.g., under management-group tag policies) and to make resource group teardown more resilient to Azure Backup’s asynchronous lock behavior.
Changes:
- Introduces backup-specific test preparers for storage accounts (policy-required tags, StorageV2) and resource groups (lock cleanup + retry on
ScopeLocked). - Updates AFS backup tests to use the local custom preparers rather than the generic testsdk ones.
- Refactors imports in backup test suites to align with the new preparer implementations.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/azure-cli/azure/cli/command_modules/backup/tests/latest/test_backup_commands.py | Adjusts preparer imports; currently still uses testsdk StorageAccountPreparer (needs alignment with new custom preparer). |
| src/azure-cli/azure/cli/command_modules/backup/tests/latest/test_afs_commands.py | Switches to using custom ResourceGroupPreparer/StorageAccountPreparer from .preparers for live testing. |
| src/azure-cli/azure/cli/command_modules/backup/tests/latest/preparers.py | Adds custom preparers: storage account creation with required tags and improved RG teardown handling lock races. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
backup |
…uard op count Use the backup-local StorageAccountPreparer (StorageV2 + BCDR-required tags) in test_backup_commands.py so the VM/CRR/restore tests' storage accounts satisfy the BCDR_StorageAccount_RequiredTags deny policy (clears the RequestDisallowedByPolicy failures). Bump test_backup_rg_mapping's expected resourceGuardOperationDetails from 9 to 14 to match the current service critical-operations set (adds backupCrossTenantVaultMappings/* and immutability duration/state operations). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Related command
Description
Testing Guide
History Notes
[Component Name 1] BREAKING CHANGE:
az command a: Make some customer-facing breaking change[Component Name 2]
az command b: Add some customer-facing featureThis checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.