Skip to content

[Consumption] Update consumption module swagger from 2023-05-01 to 2024-08-01#33222

Open
khang-11 wants to merge 2 commits into
Azure:devfrom
khang-11:feature/update-consumption-swagger
Open

[Consumption] Update consumption module swagger from 2023-05-01 to 2024-08-01#33222
khang-11 wants to merge 2 commits into
Azure:devfrom
khang-11:feature/update-consumption-swagger

Conversation

@khang-11
Copy link
Copy Markdown

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 feature


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

@azure-client-tools-bot-prd
Copy link
Copy Markdown

Hi @khang-11,
Since the current milestone time is less than 7 days, this pr will be reviewed in the next milestone.

@yonzhan
Copy link
Copy Markdown
Collaborator

yonzhan commented Apr 20, 2026

Thank you for your contribution! We will review the pull request and get back to you soon.

@github-actions
Copy link
Copy Markdown

The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR.

Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions).
After that please run the following commands to enable git hooks:

pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>

@yonzhan yonzhan requested a review from necusjz April 20, 2026 01:00
@Azure Azure deleted a comment from azure-client-tools-bot-prd Bot Apr 24, 2026
@khang-11 khang-11 force-pushed the feature/update-consumption-swagger branch from d7f56b7 to 8562050 Compare April 24, 2026 03:11
@Azure Azure deleted a comment from azure-client-tools-bot-prd Bot Apr 24, 2026
@azure-client-tools-bot-prd
Copy link
Copy Markdown

azure-client-tools-bot-prd Bot commented Apr 24, 2026

🔄AzureCLI-FullTest
️✔️acr
️✔️latest
️✔️3.12
️✔️3.13
️✔️acs
️✔️latest
️✔️3.12
️✔️3.13
️✔️advisor
️✔️latest
️✔️3.12
️✔️3.13
️✔️ams
️✔️latest
️✔️3.12
️✔️3.13
️✔️apim
️✔️latest
️✔️3.12
️✔️3.13
️✔️appconfig
️✔️latest
️✔️3.12
️✔️3.13
️✔️appservice
️✔️latest
️✔️3.12
️✔️3.13
️✔️aro
️✔️latest
️✔️3.12
️✔️3.13
️✔️backup
️✔️latest
️✔️3.12
️✔️3.13
️✔️batch
️✔️latest
️✔️3.12
️✔️3.13
️✔️batchai
️✔️latest
️✔️3.12
️✔️3.13
️✔️billing
️✔️latest
️✔️3.12
️✔️3.13
️✔️botservice
️✔️latest
️✔️3.12
️✔️3.13
️✔️cdn
️✔️latest
️✔️3.12
️✔️3.13
️✔️cloud
️✔️latest
️✔️3.12
️✔️3.13
️✔️cognitiveservices
️✔️latest
️✔️3.12
️✔️3.13
️✔️compute_recommender
️✔️latest
️✔️3.12
️✔️3.13
️✔️computefleet
️✔️latest
️✔️3.12
️✔️3.13
️✔️config
️✔️latest
️✔️3.12
️✔️3.13
️✔️configure
️✔️latest
️✔️3.12
️✔️3.13
🔄consumption
🔄latest
🔄3.12
🔄3.13
️✔️container
️✔️latest
️✔️3.12
️✔️3.13
️✔️containerapp
️✔️latest
️✔️3.12
️✔️3.13
️✔️core
️✔️latest
️✔️3.12
️✔️3.13
️✔️cosmosdb
️✔️latest
️✔️3.12
️✔️3.13
️✔️databoxedge
️✔️latest
️✔️3.12
️✔️3.13
️✔️dls
️✔️latest
️✔️3.12
️✔️3.13
️✔️dms
️✔️latest
️✔️3.12
️✔️3.13
️✔️eventgrid
️✔️latest
️✔️3.12
️✔️3.13
️✔️eventhubs
️✔️latest
️✔️3.12
️✔️3.13
️✔️feedback
️✔️latest
️✔️3.12
️✔️3.13
️✔️find
️✔️latest
️✔️3.12
️✔️3.13
️✔️hdinsight
️✔️latest
️✔️3.12
️✔️3.13
️✔️identity
️✔️latest
️✔️3.12
️✔️3.13
️✔️iot
️✔️latest
️✔️3.12
️✔️3.13
️✔️keyvault
️✔️latest
️✔️3.12
️✔️3.13
️✔️lab
️✔️latest
️✔️3.12
️✔️3.13
️✔️managedservices
️✔️latest
️✔️3.12
️✔️3.13
️✔️maps
️✔️latest
️✔️3.12
️✔️3.13
️✔️marketplaceordering
️✔️latest
️✔️3.12
️✔️3.13
️✔️monitor
️✔️latest
️✔️3.12
️✔️3.13
️✔️mysql
️✔️latest
️✔️3.12
️✔️3.13
️✔️netappfiles
️✔️latest
️✔️3.12
️✔️3.13
️✔️network
️✔️latest
️✔️3.12
️✔️3.13
️✔️policyinsights
️✔️latest
️✔️3.12
️✔️3.13
️✔️postgresql
️✔️latest
️✔️3.12
️✔️3.13
️✔️privatedns
️✔️latest
️✔️3.12
️✔️3.13
️✔️profile
️✔️latest
️✔️3.12
️✔️3.13
️✔️rdbms
️✔️latest
️✔️3.12
️✔️3.13
️✔️redis
️✔️latest
️✔️3.12
️✔️3.13
️✔️relay
️✔️latest
️✔️3.12
️✔️3.13
️✔️resource
️✔️latest
️✔️3.12
️✔️3.13
️✔️role
️✔️latest
️✔️3.12
️✔️3.13
️✔️search
️✔️latest
️✔️3.12
️✔️3.13
️✔️security
️✔️latest
️✔️3.12
️✔️3.13
️✔️servicebus
️✔️latest
️✔️3.12
️✔️3.13
️✔️serviceconnector
️✔️latest
️✔️3.12
️✔️3.13
️✔️servicefabric
️✔️latest
️✔️3.12
️✔️3.13
️✔️signalr
️✔️latest
️✔️3.12
️✔️3.13
️✔️sql
️✔️latest
️✔️3.12
️✔️3.13
️✔️sqlvm
️✔️latest
️✔️3.12
️✔️3.13
️✔️storage
️✔️latest
️✔️3.12
️✔️3.13
️✔️synapse
️✔️latest
️✔️3.12
️✔️3.13
️✔️telemetry
️✔️latest
️✔️3.12
️✔️3.13
️✔️util
️✔️latest
️✔️3.12
️✔️3.13
️✔️vm
️✔️latest
️✔️3.12
️✔️3.13

@khang-11 khang-11 changed the title update swagger [Consumption] Update consumption module swagger from 2023-05-01 to 2024-08-01 Apr 30, 2026
@microsoft-github-policy-service
Copy link
Copy Markdown
Contributor

@khang-11 please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@microsoft-github-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@microsoft-github-policy-service agree company="Microsoft"
Contributor License Agreement

Contribution License Agreement

This Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
and conveys certain license rights to Microsoft Corporation and its affiliates (“Microsoft”) for Your
contributions to Microsoft open source projects. This Agreement is effective as of the latest signature
date below.

  1. Definitions.
    “Code” means the computer software code, whether in human-readable or machine-executable form,
    that is delivered by You to Microsoft under this Agreement.
    “Project” means any of the projects owned or managed by Microsoft and offered under a license
    approved by the Open Source Initiative (www.opensource.org).
    “Submit” is the act of uploading, submitting, transmitting, or distributing code or other content to any
    Project, including but not limited to communication on electronic mailing lists, source code control
    systems, and issue tracking systems that are managed by, or on behalf of, the Project for the purpose of
    discussing and improving that Project, but excluding communication that is conspicuously marked or
    otherwise designated in writing by You as “Not a Submission.”
    “Submission” means the Code and any other copyrightable material Submitted by You, including any
    associated comments and documentation.
  2. Your Submission. You must agree to the terms of this Agreement before making a Submission to any
    Project. This Agreement covers any and all Submissions that You, now or in the future (except as
    described in Section 4 below), Submit to any Project.
  3. Originality of Work. You represent that each of Your Submissions is entirely Your original work.
    Should You wish to Submit materials that are not Your original work, You may Submit them separately
    to the Project if You (a) retain all copyright and license information that was in the materials as You
    received them, (b) in the description accompanying Your Submission, include the phrase “Submission
    containing materials of a third party:” followed by the names of the third party and any licenses or other
    restrictions of which You are aware, and (c) follow any other instructions in the Project’s written
    guidelines concerning Submissions.
  4. Your Employer. References to “employer” in this Agreement include Your employer or anyone else
    for whom You are acting in making Your Submission, e.g. as a contractor, vendor, or agent. If Your
    Submission is made in the course of Your work for an employer or Your employer has intellectual
    property rights in Your Submission by contract or applicable law, You must secure permission from Your
    employer to make the Submission before signing this Agreement. In that case, the term “You” in this
    Agreement will refer to You and the employer collectively. If You change employers in the future and
    desire to Submit additional Submissions for the new employer, then You agree to sign a new Agreement
    and secure permission from the new employer before Submitting those Submissions.
  5. Licenses.
  • Copyright License. You grant Microsoft, and those who receive the Submission directly or
    indirectly from Microsoft, a perpetual, worldwide, non-exclusive, royalty-free, irrevocable license in the
    Submission to reproduce, prepare derivative works of, publicly display, publicly perform, and distribute
    the Submission and such derivative works, and to sublicense any or all of the foregoing rights to third
    parties.
  • Patent License. You grant Microsoft, and those who receive the Submission directly or
    indirectly from Microsoft, a perpetual, worldwide, non-exclusive, royalty-free, irrevocable license under
    Your patent claims that are necessarily infringed by the Submission or the combination of the
    Submission with the Project to which it was Submitted to make, have made, use, offer to sell, sell and
    import or otherwise dispose of the Submission alone or with the Project.
  • Other Rights Reserved. Each party reserves all rights not expressly granted in this Agreement.
    No additional licenses or rights whatsoever (including, without limitation, any implied licenses) are
    granted by implication, exhaustion, estoppel or otherwise.
  1. Representations and Warranties. You represent that You are legally entitled to grant the above
    licenses. You represent that each of Your Submissions is entirely Your original work (except as You may
    have disclosed under Section 3). You represent that You have secured permission from Your employer to
    make the Submission in cases where Your Submission is made in the course of Your work for Your
    employer or Your employer has intellectual property rights in Your Submission by contract or applicable
    law. If You are signing this Agreement on behalf of Your employer, You represent and warrant that You
    have the necessary authority to bind the listed employer to the obligations contained in this Agreement.
    You are not expected to provide support for Your Submission, unless You choose to do so. UNLESS
    REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING, AND EXCEPT FOR THE WARRANTIES
    EXPRESSLY STATED IN SECTIONS 3, 4, AND 6, THE SUBMISSION PROVIDED UNDER THIS AGREEMENT IS
    PROVIDED WITHOUT WARRANTY OF ANY KIND, INCLUDING, BUT NOT LIMITED TO, ANY WARRANTY OF
    NONINFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
  2. Notice to Microsoft. You agree to notify Microsoft in writing of any facts or circumstances of which
    You later become aware that would make Your representations in this Agreement inaccurate in any
    respect.
  3. Information about Submissions. You agree that contributions to Projects and information about
    contributions may be maintained indefinitely and disclosed publicly, including Your name and other
    information that You submit with Your Submission.
  4. Governing Law/Jurisdiction. This Agreement is governed by the laws of the State of Washington, and
    the parties consent to exclusive jurisdiction and venue in the federal courts sitting in King County,
    Washington, unless no federal subject matter jurisdiction exists, in which case the parties consent to
    exclusive jurisdiction and venue in the Superior Court of King County, Washington. The parties waive all
    defenses of lack of personal jurisdiction and forum non-conveniens.
  5. Entire Agreement/Assignment. This Agreement is the entire agreement between the parties, and
    supersedes any and all prior agreements, understandings or communications, written or oral, between
    the parties relating to the subject matter hereof. This Agreement may be assigned by Microsoft.

@khang-11 khang-11 force-pushed the feature/update-consumption-swagger branch 3 times, most recently from f7f5db4 to bd501cd Compare April 30, 2026 11:51
@khang-11 khang-11 marked this pull request as ready for review May 1, 2026 01:10
Copilot AI review requested due to automatic review settings May 1, 2026 01:10
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 consumption command module to use newer Consumption RP swagger/API version (2024-08-01) and adjusts command implementations + test recordings accordingly, while attempting to preserve backward compatibility for existing CLI UX.

Changes:

  • Updated AAZ-generated Consumption operations (budgets, marketplace, pricesheet, reservation summaries/details) to api-version 2024-08-01 and new scope-based resource paths.
  • Added/updated adapters in custom.py to keep legacy CLI behavior (optional scope defaults, restored aliases, legacy filter mapping) and introduced az consumption budget update.
  • Refreshed recorded tests to reflect the new api-version in request URLs and nextLink values.

Reviewed changes

Copilot reviewed 36 out of 36 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/azure-cli/azure/cli/command_modules/consumption/tests/latest/recordings/test_list_reservations_summaries_monthly_with_reservationid.yaml Update reservation summaries recording to api-version 2024-08-01.
src/azure-cli/azure/cli/command_modules/consumption/tests/latest/recordings/test_list_reservations_summaries_monthly.yaml Update reservation summaries recording to api-version 2024-08-01.
src/azure-cli/azure/cli/command_modules/consumption/tests/latest/recordings/test_list_reservations_summaries_daily_with_reservationid.yaml Update reservation summaries (daily) recording to api-version 2024-08-01.
src/azure-cli/azure/cli/command_modules/consumption/tests/latest/recordings/test_list_reservations_summaries_daily.yaml Update reservation summaries (daily) recording to api-version 2024-08-01.
src/azure-cli/azure/cli/command_modules/consumption/tests/latest/recordings/test_list_reservations_details_with_reservationid.yaml Update reservation details recording to api-version 2024-08-01.
src/azure-cli/azure/cli/command_modules/consumption/tests/latest/recordings/test_list_reservations_details.yaml Update reservation details recording to api-version 2024-08-01.
src/azure-cli/azure/cli/command_modules/consumption/tests/latest/recordings/test_consumption_pricesheet_billing_period.yaml Update pricesheet-by-billing-period recording to api-version 2024-08-01 (incl. nextLink).
src/azure-cli/azure/cli/command_modules/consumption/tests/latest/recordings/test_consumption_pricesheet.yaml Update pricesheet recording to api-version 2024-08-01 (incl. nextLink).
src/azure-cli/azure/cli/command_modules/consumption/tests/latest/recordings/test_consumption_marketplace_list_billing_period_filter.yaml Update marketplace list recording (billing period + top) to api-version 2024-08-01 (incl. nextLink).
src/azure-cli/azure/cli/command_modules/consumption/tests/latest/recordings/test_consumption_marketplace_list_billing_period.yaml Update marketplace list (billing period) recording to api-version 2024-08-01.
src/azure-cli/azure/cli/command_modules/consumption/tests/latest/recordings/test_consumption_marketplace_list.yaml Update marketplace list recording to api-version 2024-08-01.
src/azure-cli/azure/cli/command_modules/consumption/tests/latest/recordings/test_consumption_budget_usage_create.yaml Update budget create (usage) recording to api-version 2024-08-01.
src/azure-cli/azure/cli/command_modules/consumption/tests/latest/recordings/test_consumption_budget_show.yaml Update budget show recording to api-version 2024-08-01.
src/azure-cli/azure/cli/command_modules/consumption/tests/latest/recordings/test_consumption_budget_delete.yaml Update budget delete recording to api-version 2024-08-01.
src/azure-cli/azure/cli/command_modules/consumption/tests/latest/recordings/test_consumption_budget_create.yaml Update budget create recording to api-version 2024-08-01.
src/azure-cli/azure/cli/command_modules/consumption/custom.py Add adapters for budget show/create/delete/update + marketplace scope/billing-period support and legacy filter mapping.
src/azure-cli/azure/cli/command_modules/consumption/commands.py Register the new consumption budget update command and wire updated adapters into command table.
src/azure-cli/azure/cli/command_modules/consumption/aaz/latest/consumption/reservation/summary/_list.py Regenerate reservation summaries list for api-version 2024-08-01; update resource paths and schema.
src/azure-cli/azure/cli/command_modules/consumption/aaz/latest/consumption/reservation/detail/_list.py Regenerate reservation details list for api-version 2024-08-01; update resource paths and schema.
src/azure-cli/azure/cli/command_modules/consumption/aaz/latest/consumption/pricesheet/_show.py Regenerate pricesheet show for api-version 2024-08-01; update schema (systemData, savingsPlan, etc.).
src/azure-cli/azure/cli/command_modules/consumption/aaz/latest/consumption/pricesheet/__cmd_group.py Remove preview marker from AAZ command group registration.
src/azure-cli/azure/cli/command_modules/consumption/aaz/latest/consumption/marketplace/_list.py Regenerate marketplace list for scope-based path and api-version 2024-08-01; add 204 handling + schema updates.
src/azure-cli/azure/cli/command_modules/consumption/aaz/latest/consumption/marketplace/__cmd_group.py Remove preview marker from AAZ command group registration.
src/azure-cli/azure/cli/command_modules/consumption/aaz/latest/consumption/budget/_update_with_rg.py Switch RG-scoped update-with-rg api-version metadata to 2018-01-31.
src/azure-cli/azure/cli/command_modules/consumption/aaz/latest/consumption/budget/_update.py Regenerate budget update for scope-based path and api-version 2024-08-01 (new filter model).
src/azure-cli/azure/cli/command_modules/consumption/aaz/latest/consumption/budget/_show_with_rg.py Switch RG-scoped show-with-rg api-version metadata to 2018-01-31.
src/azure-cli/azure/cli/command_modules/consumption/aaz/latest/consumption/budget/_show.py Regenerate budget show for scope-based path and api-version 2024-08-01 (new filter model).
src/azure-cli/azure/cli/command_modules/consumption/aaz/latest/consumption/budget/_list.py Regenerate budget list for scope-based path and api-version 2024-08-01 (new filter model).
src/azure-cli/azure/cli/command_modules/consumption/aaz/latest/consumption/budget/_delete_with_rg.py Switch RG-scoped delete-with-rg api-version metadata to 2018-01-31.
src/azure-cli/azure/cli/command_modules/consumption/aaz/latest/consumption/budget/_delete.py Regenerate budget delete for scope-based path and api-version 2024-08-01; add confirmation prompt.
src/azure-cli/azure/cli/command_modules/consumption/aaz/latest/consumption/budget/_create_with_rg.py Switch RG-scoped create-with-rg api-version metadata to 2018-01-31.
src/azure-cli/azure/cli/command_modules/consumption/aaz/latest/consumption/budget/_create.py Regenerate budget create for scope-based path and api-version 2024-08-01 (new filter model).
src/azure-cli/azure/cli/command_modules/consumption/aaz/latest/consumption/budget/__cmd_group.py Remove preview marker from AAZ command group registration.
src/azure-cli/azure/cli/command_modules/consumption/aaz/latest/init.py Add lint skips for generated AAZ package.
src/azure-cli/azure/cli/command_modules/consumption/_help.py Add help entry for consumption budget update.
linter_exclusions.yml Add linter exclusion entry for consumption budget update examples rule.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 14 to 16
@register_command_group(
"consumption marketplace",
is_preview=True,
)
Copy link

Copilot AI May 1, 2026

Choose a reason for hiding this comment

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

This change removes is_preview=True from the registered command group, which changes CLI surface area/metadata (preview vs GA) and is user-facing. The PR title/description focus on a swagger/api-version update; if the preview status change is intentional, it should be called out explicitly (and potentially require extra review). If it’s not intentional, consider restoring is_preview=True.

Copilot uses AI. Check for mistakes.
Comment on lines 14 to 16
@register_command_group(
"consumption pricesheet",
is_preview=True,
)
Copy link

Copilot AI May 1, 2026

Choose a reason for hiding this comment

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

This change removes is_preview=True from the registered command group, which changes CLI surface area/metadata (preview vs GA) and is user-facing. The PR title/description focus on a swagger/api-version update; if the preview status change is intentional, it should be called out explicitly (and potentially require extra review). If it’s not intentional, consider restoring is_preview=True.

Copilot uses AI. Check for mistakes.
Comment on lines 491 to 494
if resource_group_name:
from .aaz.latest.consumption.budget import CreateWithRg
args['resource_group'] = resource_group_name
return CreateWithRg(cli_ctx=cmd.cli_ctx)(command_args=args)
Copy link

Copilot AI May 1, 2026

Choose a reason for hiding this comment

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

When resource_group_name is provided, this calls CreateWithRg, but the earlier mapping now builds args["filter"] (new schema) rather than the legacy args["filters"] structure that CreateWithRg expects. As a result, --meter-filter/--resource-filter/--resource-group-filter inputs will be silently ignored for resource-group scoped budget creation (and usage-category budgets may fail server-side because meters aren’t sent). Consider either (1) populating args["filters"] for the CreateWithRg path, or (2) switching the RG path to use the 2024-08-01 scope-based Create adapter with scope set to the RG and the new filter structure.

Suggested change
if resource_group_name:
from .aaz.latest.consumption.budget import CreateWithRg
args['resource_group'] = resource_group_name
return CreateWithRg(cli_ctx=cmd.cli_ctx)(command_args=args)
subscription_scope = "/subscriptions/{}".format(cmd.cli_ctx.data['subscription_id'])
if resource_group_name:
args["scope"] = "{}/resourceGroups/{}".format(subscription_scope, resource_group_name)
else:
args["scope"] = subscription_scope

Copilot uses AI. Check for mistakes.
Comment on lines 91 to 96
session = self.client.send_request(request=request, stream=False, **kwargs)
if session.http_response.status_code in [200]:
return self.on_200(session)
if session.http_response.status_code in [204]:
return self.on_204(session)

Copy link

Copilot AI May 1, 2026

Choose a reason for hiding this comment

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

MarketplacesList.__call__ treats HTTP 204 as a success and calls on_204, but on_204 doesn’t populate ctx.vars.instance. The command’s _output unconditionally reads self.ctx.vars.instance.value, which will raise at runtime for a 204 response. Either remove the 204 success handling, or implement on_204 to set instance to an empty result (e.g., value=[], nextLink=None) and/or make _output resilient when no instance is set.

Copilot uses AI. Check for mistakes.
Comment on lines +35 to +36
self.command_table["consumption budget list"] = ConsumptionBudgetsList(loader=self)
self.command_table["consumption budget update"] = BudgetUpdateAdapter(loader=self)
Copy link

Copilot AI May 1, 2026

Choose a reason for hiding this comment

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

consumption budget update is added directly as an AAZ command, but unlike budget create/show/list it doesn’t apply transform_budget_create_update_output (or any equivalent _output override). This will make update output formatting inconsistent (e.g., numeric fields won’t be stringified like other budget commands). Consider wiring update through a custom wrapper/transform (or overriding _output in the adapter) to keep output consistent with the existing budget commands.

Suggested change
self.command_table["consumption budget list"] = ConsumptionBudgetsList(loader=self)
self.command_table["consumption budget update"] = BudgetUpdateAdapter(loader=self)
class TransformedBudgetUpdateAdapter(BudgetUpdateAdapter):
def _output(self, *args, **kwargs):
return transform_budget_create_update_output(super()._output(*args, **kwargs))
self.command_table["consumption budget list"] = ConsumptionBudgetsList(loader=self)
self.command_table["consumption budget update"] = TransformedBudgetUpdateAdapter(loader=self)

Copilot uses AI. Check for mistakes.
Comment on lines 14 to 16
@register_command_group(
"consumption budget",
is_preview=True,
)
Copy link

Copilot AI May 1, 2026

Choose a reason for hiding this comment

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

This change removes is_preview=True from the registered command group, which changes CLI surface area/metadata (preview vs GA) and is user-facing. The PR title/description focus on a swagger/api-version update; if the preview status change is intentional, it should be called out explicitly (and potentially require extra review). If it’s not intentional, consider restoring is_preview=True.

Copilot uses AI. Check for mistakes.
)
class List(AAZCommand):
"""List the marketplace for an Azure subscription within a billing period.
"""List the marketplaces for a scope at the defined scope. Marketplaces are available via this API only for May 1, 2014 or later.
Copy link

Copilot AI May 1, 2026

Choose a reason for hiding this comment

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

The command description has redundant wording (“for a scope at the defined scope”), which reads like a generation glitch and can be confusing in az consumption marketplace list -h. Consider rephrasing to a single clear sentence (e.g., “List marketplaces for the given scope …”).

Suggested change
"""List the marketplaces for a scope at the defined scope. Marketplaces are available via this API only for May 1, 2014 or later.
"""List marketplaces for the given scope. Marketplaces are available via this API only for May 1, 2014 or later.

Copilot uses AI. Check for mistakes.
@Azure Azure deleted a comment from azure-client-tools-bot-prd Bot May 1, 2026
@necusjz
Copy link
Copy Markdown
Member

necusjz commented May 7, 2026

)
class Create(AAZCommand):
"""Create operation to create or update a budget. Update operation requires latest eTag to be set in the request mandatorily. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag.
"""Create operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

the actual help message of that command is:
Image

that's due to its implementation is wrapper.

_args_schema = cls._args_schema
_args_schema.budget_name = AAZStrArg(
options=["-n", "--name", "--budget-name"],
options=["--budget-name"],
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

as it's already under budget group, the parameter name can be --name -n.

)
_args_schema.scope = AAZStrArg(
options=["--scope"],
help="The fully qualified Azure Resource manager identifier of the resource.",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
help="The fully qualified Azure Resource manager identifier of the resource.",
help="Fully qualified Azure resource manager identifier of the resource.",

@khang-11 khang-11 force-pushed the feature/update-consumption-swagger branch from bd501cd to e886da6 Compare May 13, 2026 06:23
@azure-client-tools-bot-prd
Copy link
Copy Markdown

azure-client-tools-bot-prd Bot commented May 13, 2026

❌AzureCLI-BreakingChangeTest
❌consumption
rule cmd_name rule_message suggest_message
1006 - ParaAdd consumption budget create cmd consumption budget create added parameter name please remove parameter name for cmd consumption budget create
1006 - ParaAdd consumption budget create cmd consumption budget create added parameter scope please remove parameter scope for cmd consumption budget create
1007 - ParaRemove consumption budget create cmd consumption budget create removed parameter budget_name please add back parameter budget_name for cmd consumption budget create
1007 - ParaRemove consumption budget create cmd consumption budget create removed parameter meters please add back parameter meters for cmd consumption budget create
1007 - ParaRemove consumption budget create cmd consumption budget create removed parameter resource_group_name please add back parameter resource_group_name for cmd consumption budget create
1007 - ParaRemove consumption budget create cmd consumption budget create removed parameter resource_groups please add back parameter resource_groups for cmd consumption budget create
1007 - ParaRemove consumption budget create cmd consumption budget create removed parameter resources please add back parameter resources for cmd consumption budget create
1002 - CmdRemove consumption budget create-with-rg cmd consumption budget create-with-rg removed please confirm cmd consumption budget create-with-rg removed
1006 - ParaAdd consumption budget delete cmd consumption budget delete added parameter name please remove parameter name for cmd consumption budget delete
1006 - ParaAdd consumption budget delete cmd consumption budget delete added parameter scope please remove parameter scope for cmd consumption budget delete
1007 - ParaRemove consumption budget delete cmd consumption budget delete removed parameter budget_name please add back parameter budget_name for cmd consumption budget delete
1007 - ParaRemove consumption budget delete cmd consumption budget delete removed parameter resource_group_name please add back parameter resource_group_name for cmd consumption budget delete
1002 - CmdRemove consumption budget delete-with-rg cmd consumption budget delete-with-rg removed please confirm cmd consumption budget delete-with-rg removed
1006 - ParaAdd consumption budget list cmd consumption budget list added parameter scope please remove parameter scope for cmd consumption budget list
1007 - ParaRemove consumption budget list cmd consumption budget list removed parameter resource_group please add back parameter resource_group for cmd consumption budget list
1006 - ParaAdd consumption budget show cmd consumption budget show added parameter name please remove parameter name for cmd consumption budget show
1006 - ParaAdd consumption budget show cmd consumption budget show added parameter scope please remove parameter scope for cmd consumption budget show
1007 - ParaRemove consumption budget show cmd consumption budget show removed parameter budget_name please add back parameter budget_name for cmd consumption budget show
1007 - ParaRemove consumption budget show cmd consumption budget show removed parameter resource_group_name please add back parameter resource_group_name for cmd consumption budget show
1002 - CmdRemove consumption budget show-with-rg cmd consumption budget show-with-rg removed please confirm cmd consumption budget show-with-rg removed
1006 - ParaAdd consumption budget update cmd consumption budget update added parameter name please remove parameter name for cmd consumption budget update
1006 - ParaAdd consumption budget update cmd consumption budget update added parameter scope please remove parameter scope for cmd consumption budget update
1007 - ParaRemove consumption budget update cmd consumption budget update removed parameter budget_name please add back parameter budget_name for cmd consumption budget update
1007 - ParaRemove consumption budget update cmd consumption budget update removed parameter e_tag please add back parameter e_tag for cmd consumption budget update
1007 - ParaRemove consumption budget update cmd consumption budget update removed parameter filters please add back parameter filters for cmd consumption budget update
1007 - ParaRemove consumption budget update cmd consumption budget update removed parameter time_period please add back parameter time_period for cmd consumption budget update
1002 - CmdRemove consumption budget update-with-rg cmd consumption budget update-with-rg removed please confirm cmd consumption budget update-with-rg removed
1006 - ParaAdd consumption marketplace list cmd consumption marketplace list added parameter scope please remove parameter scope for cmd consumption marketplace list
1007 - ParaRemove consumption marketplace list cmd consumption marketplace list removed parameter billing_period_name please add back parameter billing_period_name for cmd consumption marketplace list
1010 - ParaPropUpdate consumption marketplace list cmd consumption marketplace list update parameter top: updated property options from ['--top', '-t'] to ['--top'] please change property options from ['--top'] to ['--top', '-t'] for parameter top of cmd consumption marketplace list
1007 - ParaRemove consumption pricesheet show cmd consumption pricesheet show removed parameter billing_period_name please add back parameter billing_period_name for cmd consumption pricesheet show
1006 - ParaAdd consumption reservation detail list cmd consumption reservation detail list added parameter resource_scope please remove parameter resource_scope for cmd consumption reservation detail list
1010 - ParaPropUpdate consumption reservation detail list cmd consumption reservation detail list update parameter end_date: updated property options from ['--end-date', '-e'] to ['--end-date'] please change property options from ['--end-date'] to ['--end-date', '-e'] for parameter end_date of cmd consumption reservation detail list
1010 - ParaPropUpdate consumption reservation detail list cmd consumption reservation detail list update parameter start_date: updated property options from ['--start-date', '-s'] to ['--start-date'] please change property options from ['--start-date'] to ['--start-date', '-s'] for parameter start_date of cmd consumption reservation detail list
1006 - ParaAdd consumption reservation summary list cmd consumption reservation summary list added parameter resource_scope please remove parameter resource_scope for cmd consumption reservation summary list
1010 - ParaPropUpdate consumption reservation summary list cmd consumption reservation summary list update parameter end_date: updated property options from ['--end-date', '-e'] to ['--end-date'] please change property options from ['--end-date'] to ['--end-date', '-e'] for parameter end_date of cmd consumption reservation summary list
1010 - ParaPropUpdate consumption reservation summary list cmd consumption reservation summary list update parameter start_date: updated property options from ['--start-date', '-s'] to ['--start-date'] please change property options from ['--start-date'] to ['--start-date', '-s'] for parameter start_date of cmd consumption reservation summary list
1006 - ParaAdd consumption usage list cmd consumption usage list added parameter scope please remove parameter scope for cmd consumption usage list
1007 - ParaRemove consumption usage list cmd consumption usage list removed parameter billing_period_name please add back parameter billing_period_name for cmd consumption usage list
1010 - ParaPropUpdate consumption usage list cmd consumption usage list update parameter top: updated property options from ['--top', '-t'] to ['--top'] please change property options from ['--top'] to ['--top', '-t'] for parameter top of cmd consumption usage list
⚠️ 1006 - ParaAdd consumption budget create cmd consumption budget create added parameter etag
⚠️ 1006 - ParaAdd consumption budget create cmd consumption budget create added parameter filter
⚠️ 1006 - ParaAdd consumption budget create cmd consumption budget create added parameter notifications
⚠️ 1008 - ParaPropAdd consumption budget create cmd consumption budget create update parameter amount: added property aaz_type=float
⚠️ 1009 - ParaPropRemove consumption budget create cmd consumption budget create update parameter amount: removed property required=True
⚠️ 1010 - ParaPropUpdate consumption budget create cmd consumption budget create update parameter amount: updated property type from custom_type to float
⚠️ 1008 - ParaPropAdd consumption budget create cmd consumption budget create update parameter category: added property aaz_type=string
⚠️ 1008 - ParaPropAdd consumption budget create cmd consumption budget create update parameter category: added property type=string
⚠️ 1009 - ParaPropRemove consumption budget create cmd consumption budget create update parameter category: removed property required=True
⚠️ 1010 - ParaPropUpdate consumption budget create cmd consumption budget create update parameter category: updated property choices from ['cost', 'usage'] to ['Cost']
⚠️ 1008 - ParaPropAdd consumption budget create cmd consumption budget create update parameter end_date: added property aaz_type=AAZDateTimeArg
⚠️ 1009 - ParaPropRemove consumption budget create cmd consumption budget create update parameter end_date: removed property required=True
⚠️ 1010 - ParaPropUpdate consumption budget create cmd consumption budget create update parameter end_date: updated property type from custom_type to DateTime
⚠️ 1008 - ParaPropAdd consumption budget create cmd consumption budget create update parameter start_date: added property aaz_type=AAZDateTimeArg
⚠️ 1009 - ParaPropRemove consumption budget create cmd consumption budget create update parameter start_date: removed property required=True
⚠️ 1010 - ParaPropUpdate consumption budget create cmd consumption budget create update parameter start_date: updated property type from custom_type to DateTime
⚠️ 1008 - ParaPropAdd consumption budget create cmd consumption budget create update parameter time_grain: added property aaz_type=string
⚠️ 1008 - ParaPropAdd consumption budget create cmd consumption budget create update parameter time_grain: added property type=string
⚠️ 1009 - ParaPropRemove consumption budget create cmd consumption budget create update parameter time_grain: removed property required=True
⚠️ 1010 - ParaPropUpdate consumption budget create cmd consumption budget create update parameter time_grain: updated property choices from ['annually', 'monthly', 'quarterly'] to ['Annually', 'BillingAnnual', 'BillingMonth', 'BillingQuarter', 'Monthly', 'Quarterly']
⚠️ 1006 - ParaAdd consumption budget delete cmd consumption budget delete added parameter yes
⚠️ 1006 - ParaAdd consumption budget update cmd consumption budget update added parameter end_date
⚠️ 1006 - ParaAdd consumption budget update cmd consumption budget update added parameter etag
⚠️ 1006 - ParaAdd consumption budget update cmd consumption budget update added parameter filter
⚠️ 1006 - ParaAdd consumption budget update cmd consumption budget update added parameter start_date
⚠️ 1010 - ParaPropUpdate consumption budget update cmd consumption budget update update parameter category: updated property choices from ['Cost', 'Usage'] to ['Cost']
⚠️ 1010 - ParaPropUpdate consumption budget update cmd consumption budget update update parameter time_grain: updated property choices from ['Annually', 'Monthly', 'Quarterly'] to ['Annually', 'BillingAnnual', 'BillingMonth', 'BillingQuarter', 'Monthly', 'Quarterly']
⚠️ 1009 - ParaPropRemove consumption reservation detail list cmd consumption reservation detail list update parameter end_date: removed property required=True
⚠️ 1009 - ParaPropRemove consumption reservation detail list cmd consumption reservation detail list update parameter reservation_order_id: removed property required=True
⚠️ 1009 - ParaPropRemove consumption reservation detail list cmd consumption reservation detail list update parameter start_date: removed property required=True
⚠️ 1009 - ParaPropRemove consumption reservation summary list cmd consumption reservation summary list update parameter reservation_order_id: removed property required=True
⚠️ 1006 - ParaAdd consumption usage list cmd consumption usage list added parameter metric

Please submit your Breaking Change Pre-announcement ASAP if you haven't already. Please note:

  • Breaking changes can only be merged during the designated breaking change window
  • A pre-announcement must be released at least one month in advance

For more details on how to introduce breaking changes, refer to the documentation: azure-cli/doc/how_to_introduce_breaking_changes.md

…aliases, flattened --time-period, and curated examples
@khang-11 khang-11 force-pushed the feature/update-consumption-swagger branch from e886da6 to 0780d5a Compare May 13, 2026 06:58
…e tests

After regenerating the consumption module against API 2024-08-01, the
hand-written budget wrappers in commands.py / custom.py registered a
conflicting argument shape (--budget-name with no --scope) and called
aaz Create/Show/Delete without the now-required scope. Drop those
wrappers, the budget arg context in _params.py, and the now-unused
_validators.py / _transformers.py so the aaz-generated 'consumption
budget' commands take effect with their --name / --scope arguments.

Update _help.py examples to match the new argument shape (azdev
linter's faulty_help_example_parameters_rule rejected the old
--budget-name examples).

Gut test_consumption_commands.py: every existing recording was
captured at api-version 2017-11-30 / 2023-05-01 and at the old URL
shapes, so cassette playback can no longer match the new requests.
Scenarios need to be re-recorded against a live subscription.
@khang-11 khang-11 force-pushed the feature/update-consumption-swagger branch from 0780d5a to 80cf7ea Compare May 14, 2026 00:33
@@ -13,17 +13,18 @@

@register_command(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

as list command is manually registered, probably doesn't need that decorator,
Image

Comment on lines 20 to 47
helps['consumption budget create'] = """
type: command
short-summary: Create a budget for an Azure subscription.
examples:
- name: Create a cost-based monthly budget with a specified amount, start date, and end date.
text: az consumption budget create --budget-name "costbudget" --category "cost" --amount 100.0 -s "xxx" -e "xxx" --time-grain "monthly"
text: az consumption budget create --scope subscriptions/00000000-0000-0000-0000-000000000000 --name "costbudget" --category "Cost" --amount 100.0 --start-date "2024-01-01T00:00:00Z" --end-date "2024-12-31T00:00:00Z" --time-grain "Monthly"
"""

helps['consumption budget delete'] = """
type: command
short-summary: Delete a budget for an Azure subscription.
examples:
- name: Delete a budget for an Azure subscription. (autogenerated)
text: az consumption budget delete --budget-name MyBudget
crafted: true
- name: Delete a budget for an Azure subscription.
text: az consumption budget delete --scope subscriptions/00000000-0000-0000-0000-000000000000 --name MyBudget
"""

helps['consumption budget list'] = """
type: command
short-summary: List budgets for an Azure subscription.
"""

helps['consumption budget show'] = """
type: command
short-summary: Show budget for an Azure subscription.
examples:
- name: Show budget for an Azure subscription. (autogenerated)
text: az consumption budget show --budget-name MyBudget
crafted: true
- name: Show budget for an Azure subscription.
text: az consumption budget show --scope subscriptions/00000000-0000-0000-0000-000000000000 --name MyBudget
"""
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

seems they're duplicated (except list command

)
class List(AAZCommand):
"""List the marketplace for an Azure subscription within a billing period.
"""List the marketplaces for a scope at the defined scope. Marketplaces are available via this API only for May 1, 2014 or later.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
"""List the marketplaces for a scope at the defined scope. Marketplaces are available via this API only for May 1, 2014 or later.
"""List the marketplaces for a scope at the defined scope.

Comment on lines +282 to 299
def budget_output(result):
result['amount'] = str(result['amount'])
if 'currentSpend' in result:
result['currentSpend']['amount'] = str(result['currentSpend'].get('amount', None))
if 'notifications' in result:
for key in result['notifications']:
value = result['notifications'][key]
value['threshold'] = str(value.get('threshold', None))
return result


class ConsumptionBudgetsList(_ConsumptionBudgetsList):

def _output(self, *args, **kwargs):
result = self.deserialize_output(self.ctx.vars.instance.value, client_flatten=True)
from ._transformers import budget_output
result = [budget_output(item) for item in result]
next_link = self.deserialize_output(self.ctx.vars.instance.next_link)
return result, next_link
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

do we really need that? if the functionality works well without it, we can remove that kind of cusmized logic (other commands are similar

)
class Show(AAZCommand):
"""Show the price sheet for an Azure subscription within a billing period.
"""Get the price sheet for a subscription. Price sheet is available via this API only for May 1, 2014 or later.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
"""Get the price sheet for a subscription. Price sheet is available via this API only for May 1, 2014 or later.
"""Get the price sheet for a subscription..

exposes too much to the user.

"resources": [
["mgmt-plane", "/subscriptions/{}/providers/microsoft.billing/billingperiods/{}/providers/microsoft.consumption/pricesheets/default", "2023-05-01"],
["mgmt-plane", "/subscriptions/{}/providers/microsoft.consumption/pricesheets/default", "2023-05-01"],
["mgmt-plane", "/subscriptions/{}/providers/microsoft.consumption/pricesheets/default", "2024-08-01"],
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

should contian two apis, (refine its help msg then
Image

"resources": [
["mgmt-plane", "/providers/microsoft.capacity/reservationorders/{}/providers/microsoft.consumption/reservationdetails", "2023-05-01"],
["mgmt-plane", "/providers/microsoft.capacity/reservationorders/{}/reservations/{}/providers/microsoft.consumption/reservationdetails", "2023-05-01"],
["mgmt-plane", "/{resourcescope}/providers/microsoft.consumption/reservationdetails", "2024-08-01"],
Copy link
Copy Markdown
Member

@necusjz necusjz May 14, 2026

Choose a reason for hiding this comment

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

supposed to be two or three apis as well.

"resources": [
["mgmt-plane", "/providers/microsoft.capacity/reservationorders/{}/providers/microsoft.consumption/reservationsummaries", "2023-05-01"],
["mgmt-plane", "/providers/microsoft.capacity/reservationorders/{}/reservations/{}/providers/microsoft.consumption/reservationsummaries", "2023-05-01"],
["mgmt-plane", "/{resourcescope}/providers/microsoft.consumption/reservationsummaries", "2024-08-01"],
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

let's investigate how many apis it should have.

)
class List(AAZCommand):
"""List the details of Azure resource consumption, either as an invoice or within a billing period.
"""List the usage details for the defined scope. Usage details are available via this API only for May 1, 2014 or later.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
"""List the usage details for the defined scope. Usage details are available via this API only for May 1, 2014 or later.
"""List the usage details for the defined scope.

@necusjz
Copy link
Copy Markdown
Member

necusjz commented May 14, 2026

other suggestions:

  1. let's try to remove all customized logic in custom.py to make the entire solution simple.
  2. modify the test cases and record agian (via azdev test <> --live, then upload all new recording files.

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