[Az.DataProtection] Added support for cost management settings - #30086
[Az.DataProtection] Added support for cost management settings#30086vidyadharijami wants to merge 9 commits into
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
Pull request overview
This PR updates the Az.DataProtection module (AutoRest-generated) to support new Backup Vault settings, notably cost management granularity and additional immutability configuration, aligned to the DataProtection API 2026-06-01 specification.
Changes:
- Added
-CostManagementGranularity,-ImmutabilityType, and-ImmutabilityDurationInDaysupport toNew-AzDataProtectionBackupVaultandUpdate-AzDataProtectionBackupVault(with custom request-pipeline shaping + validation). - Updated generated/help documentation and module changelog to reflect the new parameters.
- Bumped the swagger/spec commit + API version usage across UX metadata and test recordings; expanded Pester coverage for cost management granularity.
Reviewed changes
Copilot reviewed 36 out of 45 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/DataProtection/DataProtection/help/Update-AzDataProtectionBackupVault.md | Help updates for new vault parameters |
| src/DataProtection/DataProtection/help/New-AzDataProtectionBackupVault.md | Help updates for new vault parameters |
| src/DataProtection/DataProtection/ChangeLog.md | Changelog entries for new parameters |
| src/DataProtection/DataProtection/Az.DataProtection.psd1 | Module manifest regeneration/metadata updates |
| src/DataProtection/DataProtection.sln | Solution project GUID refresh |
| src/DataProtection/DataProtection.Autorest/UX/Microsoft.DataProtection/resourceGuards.json | API version bump to 2026-06-01 |
| src/DataProtection/DataProtection.Autorest/UX/Microsoft.DataProtection/locations-operationStatus.json | API version bump to 2026-06-01 |
| src/DataProtection/DataProtection.Autorest/UX/Microsoft.DataProtection/locations-deletedVaults.json | API version bump to 2026-06-01 |
| src/DataProtection/DataProtection.Autorest/UX/Microsoft.DataProtection/backupVaults.json | API version bump to 2026-06-01 |
| src/DataProtection/DataProtection.Autorest/UX/Microsoft.DataProtection/backupVaults-deletedBackupInstances.json | API version bump to 2026-06-01 |
| src/DataProtection/DataProtection.Autorest/UX/Microsoft.DataProtection/backupVaults-backupResourceGuardProxies.json | API version bump to 2026-06-01 |
| src/DataProtection/DataProtection.Autorest/UX/Microsoft.DataProtection/backupVaults-backupPolicies.json | API version bump to 2026-06-01 |
| src/DataProtection/DataProtection.Autorest/UX/Microsoft.DataProtection/backupVaults-backupJobs.json | API version bump to 2026-06-01 |
| src/DataProtection/DataProtection.Autorest/UX/Microsoft.DataProtection/backupVaults-backupInstances.json | API version bump to 2026-06-01 |
| src/DataProtection/DataProtection.Autorest/UX/Microsoft.DataProtection/backupVaults-backupInstances-recoveryPoints.json | API version bump to 2026-06-01 |
| src/DataProtection/DataProtection.Autorest/test/utils.ps1 | Test environment variable adjustments |
| src/DataProtection/DataProtection.Autorest/test/Update-AzDataProtectionBackupVault.Tests.ps1 | Added CostManagementGranularity scenario test |
| src/DataProtection/DataProtection.Autorest/test/Undo-AzDataProtectionVaultDeletion.Tests.ps1 | Improved test robustness/retry behavior |
| src/DataProtection/DataProtection.Autorest/test/New-AzDataProtectionResourceGuard.Recording.json | Updated recordings for new API version |
| src/DataProtection/DataProtection.Autorest/test/New-AzDataProtectionBackupVault.Tests.ps1 | Extended create test for cost management |
| src/DataProtection/DataProtection.Autorest/test/Get-AzDataProtectionBackupVault.Recording.json | Updated recordings for new API version/data shape |
| src/DataProtection/DataProtection.Autorest/test/Get-AzDataProtectionBackupPolicy.Recording.json | Updated recordings for new API version |
| src/DataProtection/DataProtection.Autorest/test/Get-AzDataProtectionBackupInstance.Recording.json | Updated recordings for new API version |
| src/DataProtection/DataProtection.Autorest/test/Find-AzDataProtectionRestorableTimeRange.Recording.json | Updated recordings for new API version/timestamps |
| src/DataProtection/DataProtection.Autorest/test/env.json | Updated test inputs/environment configuration |
| src/DataProtection/DataProtection.Autorest/test/DiskBackupScenario.Tests.ps1 | Reduced name collision risk in live mode |
| src/DataProtection/DataProtection.Autorest/README.md | Swagger/spec commit + input-file version bump |
| src/DataProtection/DataProtection.Autorest/Properties/AssemblyInfo.cs | Version metadata update |
| src/DataProtection/DataProtection.Autorest/generate-info.json | Regeneration marker update |
| src/DataProtection/DataProtection.Autorest/docs/Update-AzDataProtectionBackupVault.md | Generated docs updates for new parameters |
| src/DataProtection/DataProtection.Autorest/docs/New-AzDataProtectionBackupVault.md | Generated docs updates for new parameters |
| src/DataProtection/DataProtection.Autorest/custom/Helpers/CommonHelpers.ps1 | Added immutability validation + request pipeline step |
| src/DataProtection/DataProtection.Autorest/custom/Cmdlets/Platform/Vault/Update-AzDataProtectionBackupVault.ps1 | Added new parameters + pipeline-based request shaping |
| src/DataProtection/DataProtection.Autorest/custom/Cmdlets/Platform/Vault/New-AzDataProtectionBackupVault.ps1 | Added new parameters + pipeline-based request shaping |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 36 out of 45 changed files in this pull request and generated no new comments.
Suppressed comments (3)
Previously missed (3) — in code that hasn't changed since the last review.
src/DataProtection/DataProtection.Autorest/custom/Cmdlets/Platform/Vault/Update-AzDataProtectionBackupVault.ps1:186
HttpPipelinePrependis documented as being "prepended to the front of the pipeline", but the immutability step is currently appended to the end of any existingHttpPipelinePrependsteps. This can change execution order (and may cause the request-body mutation to run later than intended). Prepend the step so it runs first, consistent with the parameter semantics.
if ($PSBoundParameters.ContainsKey("HttpPipelinePrepend")) {
$PSBoundParameters["HttpPipelinePrepend"] = $PSBoundParameters["HttpPipelinePrepend"] + @($immutabilityPipeline)
}
else {
$PSBoundParameters.Add("HttpPipelinePrepend", @($immutabilityPipeline))
}
src/DataProtection/DataProtection.Autorest/custom/Cmdlets/Platform/Vault/New-AzDataProtectionBackupVault.ps1:190
- Same ordering issue as Update: the immutability
SendAsyncStepis appended to existingHttpPipelinePrependsteps, even thoughHttpPipelinePrependis meant to run at the front of the pipeline. This can cause the request-body mutation to execute later than other prepended steps.
if ($PSBoundParameters.ContainsKey("HttpPipelinePrepend")) {
$PSBoundParameters["HttpPipelinePrepend"] = $PSBoundParameters["HttpPipelinePrepend"] + @($immutabilityPipeline)
}
else {
$PSBoundParameters.Add("HttpPipelinePrepend", @($immutabilityPipeline))
}
src/DataProtection/DataProtection.Autorest/Properties/AssemblyInfo.cs:24
AssemblyInfo.csupdates are flagged by the repo's FileChangeAnalyzer (it is updated automatically during the build/release process). Revert the manual version change here to avoid CI failure/warnings and keep versioning centralized.
[assembly: System.Reflection.AssemblyFileVersionAttribute("3.0.1")]
[assembly: System.Reflection.AssemblyVersionAttribute("3.0.1")]
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
There was a problem hiding this comment.
🟡 Changes recommended
The cmdlet wrappers and request pipeline logic have correctness/documentation mismatches (missing documented immutability params, incorrect HttpPipelinePrepend ordering) and the PR includes generated AssemblyInfo changes flagged by validation.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
Suppressed comments (2)
src/DataProtection/DataProtection.Autorest/custom/Cmdlets/Platform/Vault/New-AzDataProtectionBackupVault.ps1:161
- The new immutability SendAsyncStep is being appended to HttpPipelinePrepend rather than prepended. This contradicts the parameter’s documented behavior and existing usage in this repo (e.g., Undo-AzDataProtectionVaultDeletion.ps1 uses @($step) + $HttpPipelinePrepend).
if ($PSBoundParameters.ContainsKey("ImmutabilityState") -and $ImmutabilityState -ne 'Disabled') {
$immutabilityPipeline = Get-AzDataProtectionAsPerPolicyImmutabilityPipeline
if ($PSBoundParameters.ContainsKey("HttpPipelinePrepend")) {
$PSBoundParameters["HttpPipelinePrepend"] = $PSBoundParameters["HttpPipelinePrepend"] + @($immutabilityPipeline)
}
src/DataProtection/DataProtection.Autorest/custom/Cmdlets/Platform/Vault/Update-AzDataProtectionBackupVault.ps1:157
- The new immutability SendAsyncStep is being appended to HttpPipelinePrepend rather than prepended. This contradicts the parameter’s documented behavior and existing usage in this repo (e.g., Undo-AzDataProtectionVaultDeletion.ps1 uses @($step) + $HttpPipelinePrepend).
if ($PSBoundParameters.ContainsKey("ImmutabilityState") -and $ImmutabilityState -ne 'Disabled') {
$immutabilityPipeline = Get-AzDataProtectionAsPerPolicyImmutabilityPipeline
if ($PSBoundParameters.ContainsKey("HttpPipelinePrepend")) {
$PSBoundParameters["HttpPipelinePrepend"] = $PSBoundParameters["HttpPipelinePrepend"] + @($immutabilityPipeline)
}
- Files reviewed: 37/46 changed files
- Comments generated: 5
- Review effort level: Lite
There was a problem hiding this comment.
🔵 Needs a closer look
The new immutability HTTP pipeline step needs null-safe handling for missing nested JSON objects, and AssemblyInfo.cs should be reverted per repo validation that it is auto-managed.
Review details
Suppressed comments (2)
src/DataProtection/DataProtection.Autorest/custom/Helpers/CommonHelpers.ps1:153
Get-AzDataProtectionAsPerPolicyImmutabilityPipelineassumes$requestBody.properties.securitySettings.immutabilitySettingsalready exists. If the request body doesn’t include one of these intermediate objects (e.g., a PATCH body shape change), this will throw a null-valued expression error and break vault create/update when the immutability pipeline is injected. Consider defensively creating the missing nested objects before accessing.configuration.
$requestBody = $request.Content.ReadAsStringAsync().GetAwaiter().GetResult() | ConvertFrom-Json
if ($null -eq $requestBody.properties.securitySettings.immutabilitySettings.configuration) {
$requestBody.properties.securitySettings.immutabilitySettings |
Add-Member -MemberType NoteProperty -Name configuration -Value ([PSCustomObject]@{})
}
src/DataProtection/DataProtection.Autorest/Properties/AssemblyInfo.cs:24
- This PR updates
AssemblyInfo.cs, but the repo’s PR validation explicitly flags this file as auto-updated (“AssemblyInfo.cs will be updated automatically. Please do not update it manually.”). To avoid recurring validation noise and accidental version drift, revert the manual version edits here.
[assembly: System.Reflection.AssemblyFileVersionAttribute("3.0.1")]
[assembly: System.Reflection.AssemblyVersionAttribute("3.0.1")]
- Files reviewed: 43/52 changed files
- Comments generated: 0 new
- Review effort level: Lite
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
There was a problem hiding this comment.
🟡 Changes recommended
The Update-AzDataProtectionBackupVault CMK path can pass an unsupported parameter to Get-AzDataProtectionBackupVault (binding failure), and Update-AzDataProtectionBackupVault help documents unsupported parameter sets/parameters.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
Suppressed comments (1)
src/DataProtection/DataProtection.Autorest/Properties/AssemblyInfo.cs:24
- PR validation warns that AssemblyInfo.cs is updated automatically; manually changing assembly versions here will be flagged and can be overwritten by the build. Please revert these version attribute edits and let the build tooling generate them.
[assembly: System.Reflection.AssemblyFileVersionAttribute("3.0.1")]
[assembly: System.Reflection.AssemblyVersionAttribute("3.0.1")]
- Files reviewed: 42/52 changed files
- Comments generated: 3
- Review effort level: Lite
There was a problem hiding this comment.
🔵 Needs a closer look
The PR includes an AutoRest-generated AssemblyInfo version change that should be reverted (auto-managed), and the new cost-management parameter help text needs clarification for the ViaIdentity parameter name/allowed values.
Review details
Suppressed comments (3)
src/DataProtection/DataProtection.Autorest/Properties/AssemblyInfo.cs:26
- This file is AutoRest-generated (see header) and is flagged by PR validation as an auto-updated file; keeping manual version edits here will be overwritten during regeneration/build and creates noisy diffs. Please revert the AssemblyVersion/AssemblyFileVersion changes in this PR and let the build tooling manage them.
[assembly: System.Reflection.AssemblyFileVersionAttribute("3.0.1")]
[assembly: System.Reflection.AssemblyVersionAttribute("3.0.1")]
[assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)]
[assembly: System.CLSCompliantAttribute(false)]
src/DataProtection/DataProtection/help/Update-AzDataProtectionBackupVault.md:252
- The description for
-CostManagementSettingGranularityLevelis too vague compared to-CostManagementGranularityand doesn't state the allowed values, which makes the help less actionable. Please align the description/allowed values with the user-facing parameter.
src/DataProtection/DataProtection.Autorest/docs/Update-AzDataProtectionBackupVault.md:251 - The
-CostManagementSettingGranularityLevelparameter description is currently generic and omits the allowed values. Align it with-CostManagementGranularityso users know which strings are accepted.
Settings for granularity level
- Files reviewed: 39/49 changed files
- Comments generated: 0 new
- Review effort level: Lite
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
There was a problem hiding this comment.
🟡 Changes recommended
The public help for Update-AzDataProtectionBackupVault is inconsistent with the exported wrapper’s parameter sets, and AssemblyInfo.cs changes should be reverted to satisfy repo tooling/validation expectations.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
Suppressed comments (2)
src/DataProtection/DataProtection/help/Update-AzDataProtectionBackupVault.md:32
- The help file advertises an
UpdateViaIdentityExpandedparameter set (with-InputObject,-XmsDeletedVaultId, etc.), but the customUpdate-AzDataProtectionBackupVaultwrapper only defines theUpdateExpandedparameter set, so these parameters aren’t actually supported and the help is misleading.
src/DataProtection/DataProtection.Autorest/Properties/AssemblyInfo.cs:24 - PR validation warns that
AssemblyInfo.csis auto-updated; committing version changes here typically causes the File Change Check to fail. Revert these assembly version attributes to their previous values and let the release/build tooling update them.
[assembly: System.Reflection.AssemblyFileVersionAttribute("3.0.1")]
[assembly: System.Reflection.AssemblyVersionAttribute("3.0.1")]
- Files reviewed: 39/49 changed files
- Comments generated: 1
- Review effort level: Lite
| ### -CostManagementSettingGranularityLevel | ||
| Settings for granularity level | ||
|
|
||
| ```yaml | ||
| Type: System.String | ||
| Parameter Sets: UpdateViaIdentityExpanded | ||
| Aliases: | ||
|
|
||
| Required: False | ||
| Position: Named | ||
| Default value: None | ||
| Accept pipeline input: False | ||
| Accept wildcard characters: False | ||
| ``` |
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
There was a problem hiding this comment.
🟡 Changes recommended
The PR introduces doc/manifest inconsistencies (help documents a non-existent parameter and there are CI-blocking auto-generated file/manifest churn changes) that should be corrected before approval.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
Suppressed comments (4)
Previously missed (2) — in code that hasn't changed since the last review.
src/DataProtection/DataProtection/Az.DataProtection.psd1:54
- This bumps the minimum required Az.Accounts version to 5.5.2. Unless Az.DataProtection now depends on a feature/fix in 5.5.2, prefer keeping the previous minimum to avoid forcing upgrades for users; if it is required, please call it out explicitly in the PR description/changelog.
src/DataProtection/DataProtection/Az.DataProtection.psd1:63 ScriptsToProcessandTypesToProcesswere previously omitted/commented; setting them explicitly to empty arrays is functional but creates unnecessary manifest churn unrelated to the feature change. Prefer restoring the prior commented form unless there’s a specific reason to materialize these keys.
src/DataProtection/DataProtection/help/Update-AzDataProtectionBackupVault.md:32
- The help syntax lists
-CostManagementSettingGranularityLevel, but the publicUpdate-AzDataProtectionBackupVaultfunction only exposes-CostManagementGranularity(and does not defineCostManagementSettingGranularityLevel). This makes the help inaccurate and confusing; please remove this parameter from the syntax (or add a matching public parameter/alias ifUpdateViaIdentityExpandedis intended to support it).
src/DataProtection/DataProtection/help/Update-AzDataProtectionBackupVault.md:263 - This parameter section documents
-CostManagementSettingGranularityLevel, but that parameter is not part of the public cmdlet signature incustom/Cmdlets/Platform/Vault/Update-AzDataProtectionBackupVault.ps1. Please remove this section so the help only documents supported parameters (or regenerate help after adding a public-facing parameter/alias).
- Files reviewed: 38/49 changed files
- Comments generated: 1
- Review effort level: Lite
| [assembly: System.Reflection.AssemblyVersionAttribute("2.10.1")] | ||
| [assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)] | ||
| [assembly: System.CLSCompliantAttribute(false)] | ||
| [assembly: System.CLSCompliantAttribute(false)] No newline at end of file |
🤖 PR Validation —⚠️ Review suggested
️✔️Az.Accounts
Description
Mandatory Checklist
Please choose the target release of Azure PowerShell. (⚠️ Target release is a different concept from API readiness. Please click below links for details.)
Check this box to confirm: I have read the Submitting Changes section of
CONTRIBUTING.mdand reviewed the following information:ChangeLog.mdfile(s) appropriatelysrc/{{SERVICE}}/{{SERVICE}}/ChangeLog.md.## Upcoming Releaseheader in the past tense.ChangeLog.mdif no new release is required, such as fixing test case only.