Added support for cost management settings#33757
Open
vidyadharijami wants to merge 6 commits into
Open
Conversation
… 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>
…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>
|
Hi @vidyadharijami, |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Azure CLI Backup module to support configuring Recovery Services Vault cost management settings (granularity) and aligns the Recovery Services management SDK dependency to a newer version needed for the updated vault models.
Changes:
- Bump
azure-mgmt-recoveryservicesto4.1.0across setup and platform-specific requirements. - Add
--cost-management-granularitysupport toaz backup vault create/update, including defaulting toVaultLevelon create. - Update vault immutability update logic to include an
ImmutabilityConfigurationwhen enabling immutability, and extend tests to validate cost management behavior.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/azure-cli/setup.py | Updates azure-mgmt-recoveryservices dependency range to ~=4.1.0. |
| src/azure-cli/requirements.py3.windows.txt | Pins azure-mgmt-recoveryservices==4.1.0 for Windows builds. |
| src/azure-cli/requirements.py3.Linux.txt | Pins azure-mgmt-recoveryservices==4.1.0 for Linux builds. |
| src/azure-cli/requirements.py3.Darwin.txt | Pins azure-mgmt-recoveryservices==4.1.0 for macOS builds. |
| src/azure-cli/azure/cli/command_modules/backup/custom.py | Implements cost management settings update/create plumbing and immutability configuration handling. |
| src/azure-cli/azure/cli/command_modules/backup/_params.py | Exposes the new --cost-management-granularity enum parameter for create/update. |
| src/azure-cli/azure/cli/command_modules/backup/tests/latest/test_backup_commands.py | Adds assertions and update coverage for cost management granularity. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+347
to
+353
| if existing_vault is not None: | ||
| cost_management_settings = existing_vault.properties.cost_management_settings | ||
| else : | ||
| # Create scenario | ||
| cost_management_settings = CostManagementSettings() | ||
| cost_management_settings.granularity_level = "VaultLevel" | ||
|
|
Comment on lines
+222
to
+228
| return update_vault(cmd, client, vault_name, resource_group_name, tags=tags, | ||
| public_network_access=public_network_access, | ||
| immutability_state=immutability_state, | ||
| cross_subscription_restore_state=cross_subscription_restore_state, | ||
| classic_alerts=classic_alerts, | ||
| azure_monitor_alerts_for_job_failures=azure_monitor_alerts_for_job_failures, | ||
| cost_management_granularity=cost_management_granularity) |
| allowed_rehyd_priority_type = ['Standard', 'High'] | ||
| allowed_softdelete_options = ['Enable', 'Disable', 'AlwaysOn'] | ||
| allowed_immutability_options = ['Disabled', 'Locked', 'Unlocked'] | ||
| allowed_granularitylevel_options = ['VaultLevel','ProtectedItemLevel','ProtectedItemWithParentTag'] |
…ure-cli into deve/vijami/clichanges
Collaborator
|
backup |
…ure-cli into deve/vijami/clichanges
Member
|
/azp run |
| Command 'run |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.