Skip to content

[DataProtection] Added support for cost management settings - #10280

Open
vidyadharijami wants to merge 2 commits into
Azure:mainfrom
vidyadharijami:dev/vijami/dppcms
Open

[DataProtection] Added support for cost management settings#10280
vidyadharijami wants to merge 2 commits into
Azure:mainfrom
vidyadharijami:dev/vijami/dppcms

Conversation

@vidyadharijami

@vidyadharijami vidyadharijami commented Aug 31, 2026

Copy link
Copy Markdown
Member

🤖 PR Validation — ⚠️ Review suggested

Breaking Changes
⚠️ None
⚠️Azure CLI Extensions Breaking Change Test
⚠️dataprotection
rule cmd_name rule_message suggest_message
⚠️ 1006 - ParaAdd dataprotection backup-vault create cmd dataprotection backup-vault create added parameter cost_management_granularity
⚠️ 1006 - ParaAdd dataprotection backup-vault create cmd dataprotection backup-vault create added parameter x_ms_deleted_vault_id
⚠️ 1009 - ParaPropRemove dataprotection backup-vault create cmd dataprotection backup-vault create update parameter storage_setting: removed property required=True
⚠️ 1006 - ParaAdd dataprotection backup-vault identity assign cmd dataprotection backup-vault identity assign added parameter x_ms_deleted_vault_id
⚠️ 1006 - ParaAdd dataprotection backup-vault identity remove cmd dataprotection backup-vault identity remove added parameter x_ms_deleted_vault_id
⚠️ 1006 - ParaAdd dataprotection backup-vault update cmd dataprotection backup-vault update added parameter cost_management_granularity
⚠️ 1006 - ParaAdd dataprotection backup-vault update cmd dataprotection backup-vault update added parameter x_ms_deleted_vault_id

This checklist is used to make sure that common guidelines for a pull request are followed.

Related command

General Guidelines

  • Have you run azdev style <YOUR_EXT> locally? (pip install azdev required)
  • Have you run python scripts/ci/test_index.py -q locally? (pip install azdev required)
  • My extension version conforms to the Extension version schema

For new extensions:

About Extension Publish

There is a pipeline to automatically build, upload and publish extension wheels.
Once your pull request is merged into main branch, a new pull request will be created to update src/index.json automatically.
You only need to update the version information in file setup.py and historical information in file HISTORY.rst in your PR but do not modify src/index.json.

Copilot AI lite review requested due to automatic review settings August 31, 2026 12:03
@azure-client-tools-bot-prd

Copy link
Copy Markdown

Hi vidyadharijami,
Please write the description of changes which can be perceived by customers into HISTORY.rst.
If you want to release a new extension version, please update the version in pyproject.toml (or setup.py, if the extension has not migrated yet) as well.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the Data Protection extension to support Cost Management settings on Backup Vaults, alongside a broader refresh to the 2026-06-01 DataProtection management-plane API version and corresponding test/recording updates.

Changes:

  • Add --cost-management-granularity support to az dataprotection backup-vault create/update and include costManagementSettings.granularityLevel in the AAZ schema.
  • Bump dataprotection backup-vault (and identity) AAZ commands from API version 2025-07-01 to 2026-06-01.
  • Update scenario tests/utilities and re-recordings to reflect new behavior (including improved job failure reporting).

Reviewed changes

Copilot reviewed 21 out of 32 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/dataprotection/azext_dataprotection/tests/utils.py Improves job polling assertions to surface failure details and unexpected statuses.
src/dataprotection/azext_dataprotection/tests/latest/test_dataprotection_cosmosdb.py Updates CosmosDB policy/template unit-test constants used to build example resource IDs.
src/dataprotection/azext_dataprotection/tests/latest/test_dataprotection_backup_vault.py Extends backup-vault tests to validate cost management settings.
src/dataprotection/azext_dataprotection/tests/latest/test_dataprotection_backup_instance_operations.py Updates scenario test parameters (subscription/policy IDs, etc.).
src/dataprotection/azext_dataprotection/tests/latest/test_dataprotection_backup_instance_create_and_delete.py Updates scenario test parameters (location/subscription IDs).
src/dataprotection/azext_dataprotection/tests/latest/test_dataprotection_backup_and_restore_workloads.py Adds “reuse existing” path for backup-instance validation and updates CosmosDB live scenario constants.
src/dataprotection/azext_dataprotection/tests/latest/recordings/test_dataprotection_backup_vault_list_from_resource_graph.yaml Updates recording output to match current service/API responses.
src/dataprotection/azext_dataprotection/tests/latest/recordings/test_dataprotection_backup_policy_manual.yaml Refreshes recording (API version/user-agent/response shape).
src/dataprotection/azext_dataprotection/tests/latest/recordings/test_dataprotection_backup_policy_create_and_delete.yaml Refreshes recording (API version/user-agent/response shape).
src/dataprotection/azext_dataprotection/tests/latest/recordings/test_dataprotection_backup_instance_restore_blob_recovery_point.yaml Refreshes recording (SDK/user-agent changes and response differences).
src/dataprotection/azext_dataprotection/tests/latest/recordings/test_dataprotection_backup_instance_list_from_resource_graph.yaml Refreshes recording output to match current service/API responses.
src/dataprotection/azext_dataprotection/aaz/latest/dataprotection/backup_vault/identity/_wait.py Moves identity wait to 2026-06-01 and adds costManagementSettings to schema.
src/dataprotection/azext_dataprotection/aaz/latest/dataprotection/backup_vault/identity/_show.py Moves identity show to 2026-06-01 and adds costManagementSettings to schema.
src/dataprotection/azext_dataprotection/aaz/latest/dataprotection/backup_vault/identity/_remove.py Moves identity remove to 2026-06-01 and adds deleted-vault header + schema updates.
src/dataprotection/azext_dataprotection/aaz/latest/dataprotection/backup_vault/identity/_assign.py Moves identity assign to 2026-06-01 and adds deleted-vault header + schema updates.
src/dataprotection/azext_dataprotection/aaz/latest/dataprotection/backup_vault/_wait.py Moves vault wait to 2026-06-01 and adds costManagementSettings to schema.
src/dataprotection/azext_dataprotection/aaz/latest/dataprotection/backup_vault/_update.py Adds cost management arg + request mapping; bumps API version; adds deleted-vault header.
src/dataprotection/azext_dataprotection/aaz/latest/dataprotection/backup_vault/_show.py Moves vault show to 2026-06-01 and adds costManagementSettings to schema.
src/dataprotection/azext_dataprotection/aaz/latest/dataprotection/backup_vault/_list.py Moves vault list to 2026-06-01 and adds costManagementSettings to schema.
src/dataprotection/azext_dataprotection/aaz/latest/dataprotection/backup_vault/_delete.py Moves vault delete to 2026-06-01.
src/dataprotection/azext_dataprotection/aaz/latest/dataprotection/backup_vault/_create.py Adds cost management arg + request mapping; bumps API version; adds deleted-vault header.
Suppressed comments (2)

src/dataprotection/azext_dataprotection/tests/latest/test_dataprotection_backup_instance_operations.py:84

  • This test is not marked @live_only(), but it hardcodes a specific subscription ID and switches the CLI context via az account set. In playback/CI this commonly fails because the test profile won’t contain that subscription, and it also bakes a real subscription GUID into the repo. Prefer using the active test subscription and avoid forcing an account switch (then re-record/sanitize as needed).
        test.kwargs.update({
            'subscriptionId': '38304e13-357e-405e-9e9a-220351dcce8c',
            'originalSubscriptionId': test.cmd('az account show --query id -o tsv').output.strip(),
            'rg': 'clitest-dpp-rg',
            'vaultName': 'clitest-bkp-vault-donotdelete',
            'backupInstanceName': 'clitestblobvijami-clitestblobvijami-92e88a05-3816-418b-8987-1285f34c2030',
            'policyName': 'blobpolicy',
            'policyId': '/subscriptions/38304e13-357e-405e-9e9a-220351dcce8c/resourceGroups/clitest-dpp-rg/providers/Microsoft.DataProtection/backupVaults/clitest-bkp-vault-donotdelete/backupPolicies/blobpolicy',
            'altPolicyName': 'altvaultpolicy',
            'altPolicyId': '/subscriptions/38304e13-357e-405e-9e9a-220351dcce8c/resourceGroups/clitest-dpp-rg/providers/Microsoft.DataProtection/backupVaults/clitest-bkp-vault-donotdelete/backupPolicies/altvaultpolicy'
        })
        test.addCleanup(lambda: test.cmd('az account set --subscription "{originalSubscriptionId}"'))
        test.cmd('az account set --subscription "{subscriptionId}"')
        test.cmd('az dataprotection backup-instance wait -g "{rg}" --vault-name "{vaultName}" --backup-instance-name "{backupInstanceName}" --timeout 300 '

src/dataprotection/azext_dataprotection/tests/latest/test_dataprotection_backup_instance_create_and_delete.py:69

  • This test is not marked @live_only(), but it hardcodes a specific subscription ID and calls az account set to switch context. That will typically break playback/CI (subscription not present in the mocked profile) and leaks a real subscription GUID into the repo. Prefer using the active subscription and avoid forcing the switch, then re-record/sanitize recordings if needed.
        test.kwargs.update({
            'subscriptionId': '38304e13-357e-405e-9e9a-220351dcce8c',
            'originalSubscriptionId': test.cmd('az account show --query id -o tsv').output.strip(),
            'dataSourceType': "AzureDisk",
            'permissionsScope': "Resource",
            'policyId': '/subscriptions/38304e13-357e-405e-9e9a-220351dcce8c/resourceGroups/clitest-dpp-rg/providers/Microsoft.DataProtection/backupVaults/clitest-bkp-vault-donotdelete/backupPolicies/diskpolicy',
            'diskName': 'clitest-disk-donotdelete',
            'diskId': '/subscriptions/38304e13-357e-405e-9e9a-220351dcce8c/resourceGroups/clitest-dpp-rg/providers/Microsoft.Compute/disks/clitest-disk-donotdelete',
            'policyRuleName': "BackupHourly"
        })
        test.addCleanup(lambda: test.cmd('az account set --subscription "{originalSubscriptionId}"'))
        test.cmd('az account set --subscription "{subscriptionId}"')

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +25 to +28
SUBSCRIPTION_ID = '38304e13-357e-405e-9e9a-220351dcce8c'
RESOURCE_GROUP = 'cosmosbugbash-vijami-rg'
SOURCE_COSMOS_NAME = 'cosmosbugbash-vijami-src3'
TARGET_COSMOS_NAME = 'cosmosbugbash-vijami-tgt2'
- nosniff
x-ms-arm-resource-system-data:
- '{"lastModifiedBy":"ianna@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2025-11-04T08:56:26.9783883Z"}'
- '{"lastModifiedBy":"vijami@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2026-08-31T07:02:26.2004809Z"}'
- nosniff
x-ms-arm-resource-system-data:
- '{"lastModifiedBy":"ianna@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2026-05-19T05:02:16.1055522Z"}'
- '{"lastModifiedBy":"vijami@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2026-08-31T07:02:41.1666376Z"}'
code: 202
message: Accepted
- request:
body: '{"subscriptions": ["38304e13-357e-405e-9e9a-220351dcce8c"], "query": "RecoveryServicesResources
@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 2 pipeline(s).

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