Skip to content

Add az aks list-vm-skus command to aks-preview extension#9698

Merged
yanzhudd merged 7 commits intoAzure:mainfrom
CustardTart32:czhong/aks-list-vm-skus
Mar 23, 2026
Merged

Add az aks list-vm-skus command to aks-preview extension#9698
yanzhudd merged 7 commits intoAzure:mainfrom
CustardTart32:czhong/aks-list-vm-skus

Conversation

@CustardTart32
Copy link
Copy Markdown
Member

@CustardTart32 CustardTart32 commented Mar 18, 2026


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

Related command

az aks list-vm-skus

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 wheel==0.30.0 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 review requested due to automatic review settings March 18, 2026 01:41
@azure-client-tools-bot-prd
Copy link
Copy Markdown

azure-client-tools-bot-prd Bot commented Mar 18, 2026

⚠️Azure CLI Extensions Breaking Change Test
⚠️aks-preview
rule cmd_name rule_message suggest_message
⚠️ 1001 - CmdAdd aks list-vm-skus cmd aks list-vm-skus added

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

Hi @CustardTart32,
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 setup.py as well.

@yonzhan
Copy link
Copy Markdown
Collaborator

yonzhan commented Mar 18, 2026

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

@github-actions
Copy link
Copy Markdown
Contributor

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>

@github-actions
Copy link
Copy Markdown
Contributor

CodeGen Tools Feedback Collection

Thank you for using our CodeGen tool. We value your feedback, and we would like to know how we can improve our product. Please take a few minutes to fill our codegen survey

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

Adds a new az aks list-vm-skus command to the aks-preview extension, backed by the AKS vmSkus ARM endpoint, with client-side filtering and table output formatting.

Changes:

  • Introduces aks list-vm-skus command wiring (client factory, command registration, args) and implements filtering (--size, --zone, --all).
  • Adds table formatter for -o table output.
  • Adds unit tests for SKU availability logic and command filtering, plus a scenario test.

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/aks-preview/azext_aks_preview/vm_skus_util.py Adds helper to evaluate subscription/zone availability based on SKU restrictions.
src/aks-preview/azext_aks_preview/custom.py Implements aks_list_vm_skus custom command (fetch + filters).
src/aks-preview/azext_aks_preview/commands.py Registers aks list-vm-skus command and hooks table transformer.
src/aks-preview/azext_aks_preview/_params.py Defines CLI parameters for aks list-vm-skus (--location, --size, --zone, --all).
src/aks-preview/azext_aks_preview/_format.py Adds aks_list_vm_skus_table_format for table output summarization.
src/aks-preview/azext_aks_preview/_client_factory.py Adds cf_vm_skus to access ContainerServiceClient.vm_skus.
src/aks-preview/azext_aks_preview/tests/latest/test_vm_skus.py Unit tests for _aks_is_vm_sku_available.
src/aks-preview/azext_aks_preview/tests/latest/test_custom.py Unit tests for aks_list_vm_skus filtering behavior.
src/aks-preview/azext_aks_preview/tests/latest/test_aks_commands.py Adds scenario coverage for aks list-vm-skus basic/filtered calls.

Comment thread src/aks-preview/azext_aks_preview/vm_skus_util.py Outdated
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 18, 2026

Hi @CustardTart32

Release Suggestions

Module: aks-preview

  • Update VERSION to 19.0.0b28 in src/aks-preview/setup.py

Notes

@FumingZhang
Copy link
Copy Markdown
Member

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 2 pipeline(s).

Comment on lines +3214 to +3215
options_list=["--zone", "-z"],
arg_type=get_three_state_flag(),
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 need a three-state flag here? From what I understand, the list API already handles results with this filter by default. Wouldn't a single state be enough to toggle the filter? I'm concerned because we rarely use three-state flags in the aks command group, except for a few cases like the greater monitoring addon. This could affect consistency across all commands. The same applies to the --show-all option

Copy link
Copy Markdown
Member Author

@CustardTart32 CustardTart32 Mar 18, 2026

Choose a reason for hiding this comment

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

Changed to use a store_true action.

In term of the list API itself, it will filter out VM SKU's that are restricted by region but not by AZ (this might actually be an oversight that should be fixed in the internal API implementation).

The --zone flag is different in that it filters out any VM SKUs that do not have zones associated.

Copy link
Copy Markdown
Member

@FumingZhang FumingZhang left a comment

Choose a reason for hiding this comment

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

Queued live test to validate the change.

@CustardTart32 CustardTart32 force-pushed the czhong/aks-list-vm-skus branch 3 times, most recently from e7ba3dc to 6b81746 Compare March 18, 2026 07:13
@FumingZhang
Copy link
Copy Markdown
Member

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 2 pipeline(s).

@FumingZhang
Copy link
Copy Markdown
Member

Re-queued live test.

@FumingZhang
Copy link
Copy Markdown
Member

Re-queued live test.

The test failed with an error. Need to queue the test using a sub that has the specific feature flag registered?

  assert len(skus) > 0, "expected at least one SKU in eastus"

E AssertionError: expected at least one SKU in eastus
E assert 0 > 0
E + where 0 = len([])

@CustardTart32
Copy link
Copy Markdown
Member Author

What subscription is the live test being run against? This seems pretty strange. I run the live tests locally in a loop and didn't get any test failures for test_aks_list_vm_skus

@CustardTart32 CustardTart32 force-pushed the czhong/aks-list-vm-skus branch from 6b81746 to 0890873 Compare March 19, 2026 06:30
@FumingZhang
Copy link
Copy Markdown
Member

This one 79a7390d-3a85-432d-9f6f-a11a703c8b83

@FumingZhang
Copy link
Copy Markdown
Member

fixing the CI failure in #9703

@CustardTart32
Copy link
Copy Markdown
Member Author

Fixed the live test failure. Turns out that subscription didn't have any vm skus available in eastus. Switched over to westus2.

@FumingZhang
Copy link
Copy Markdown
Member

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 2 pipeline(s).

@FumingZhang
Copy link
Copy Markdown
Member

fixing the CI failure in #9703

Please rebase from main to pick up the fix, cc @CustardTart32

The CI GH Azdev Linter / azdev-linter (pull_request_target) sets up the test environment based on your branch's HEAD, not the merge reference, so it won't automatically pick up the fix.

CustardTart32 and others added 7 commits March 20, 2026 12:01
Implements a new CLI command that lists VM SKUs available for AKS node
pools in a given location by querying the AKS-specific vmSkus endpoint,
mirroring the shape and filtering behavior of 'az vm list-skus'.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…_aks_list_vm_skus

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@CustardTart32 CustardTart32 force-pushed the czhong/aks-list-vm-skus branch from 2c8b11f to 688f9f3 Compare March 20, 2026 01:06
@FumingZhang
Copy link
Copy Markdown
Member

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 2 pipeline(s).

@yanzhudd
Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 2 pipeline(s).

@yanzhudd yanzhudd merged commit 7b437ef into Azure:main Mar 23, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AKS Auto-Assign Auto assign by bot

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants