Skip to content

Conversation

@william051200
Copy link
Member

@william051200 william051200 commented Dec 4, 2025

Related command

az vmss get-resiliency-view --instance instance_id
az vmss list-instances --resiliency-view

Description

Resolve #32361

Testing Guide

To make sure list-instances will show instances within the vmss with their resiliency status.
az vmss list-instances --resiliency-view

To make sure resiliency status is being shown for target instance.
az vmss get-resiliency-view --instance instance_id

History Notes

[Compute] az vmss list-instances: Add new argument --resiliency-view to show resiliency status of each instance
[Compute] az vmss get-resiliency-view: Add new command to show resiliency status of each instance


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

Copilot AI review requested due to automatic review settings December 4, 2025 02:05
@azure-client-tools-bot-prd
Copy link

azure-client-tools-bot-prd bot commented Dec 4, 2025

️✔️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
️✔️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

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

azure-client-tools-bot-prd bot commented Dec 4, 2025

⚠️AzureCLI-BreakingChangeTest
⚠️vm
rule cmd_name rule_message suggest_message
⚠️ 1001 - CmdAdd vmss get-resiliency-view cmd vmss get-resiliency-view added
⚠️ 1006 - ParaAdd vmss list-instances cmd vmss list-instances added parameter resiliency_view
⚠️ 1009 - ParaPropRemove vmss list-instances cmd vmss list-instances update parameter expand: removed property aaz_type=string
⚠️ 1009 - ParaPropRemove vmss list-instances cmd vmss list-instances update parameter expand: removed property type=string
⚠️ 1009 - ParaPropRemove vmss list-instances cmd vmss list-instances update parameter filter: removed property aaz_type=string
⚠️ 1009 - ParaPropRemove vmss list-instances cmd vmss list-instances update parameter filter: removed property type=string
⚠️ 1009 - ParaPropRemove vmss list-instances cmd vmss list-instances update parameter pagination_limit: removed property aaz_type=int
⚠️ 1009 - ParaPropRemove vmss list-instances cmd vmss list-instances update parameter pagination_token: removed property aaz_type=string
⚠️ 1009 - ParaPropRemove vmss list-instances cmd vmss list-instances update parameter pagination_token: removed property type=string
⚠️ 1009 - ParaPropRemove vmss list-instances cmd vmss list-instances update parameter resource_group: removed property aaz_type=string
⚠️ 1009 - ParaPropRemove vmss list-instances cmd vmss list-instances update parameter resource_group: removed property type=string
⚠️ 1010 - ParaPropUpdate vmss list-instances cmd vmss list-instances update parameter resource_group: updated property name from resource_group to resource_group_name
⚠️ 1009 - ParaPropRemove vmss list-instances cmd vmss list-instances update parameter select: removed property aaz_type=string
⚠️ 1009 - ParaPropRemove vmss list-instances cmd vmss list-instances update parameter select: removed property type=string
⚠️ 1008 - ParaPropAdd vmss list-instances cmd vmss list-instances update parameter virtual_machine_scale_set_name: added property id_part=virtual_machine_scale_set_name
⚠️ 1009 - ParaPropRemove vmss list-instances cmd vmss list-instances update parameter virtual_machine_scale_set_name: removed property aaz_type=string
⚠️ 1009 - ParaPropRemove vmss list-instances cmd vmss list-instances update parameter virtual_machine_scale_set_name: removed property type=string

@yonzhan
Copy link
Collaborator

yonzhan commented Dec 4, 2025

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

@github-actions
Copy link

github-actions bot commented Dec 4, 2025

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>

Copy link
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

This PR adds resiliency view functionality to Azure CLI VMSS commands, enabling users to view the resiliency status of virtual machine scale set instances through two new commands: az vmss get-resiliency-view and az vmss list-instances --resiliency-view.

Key Changes

  • Added VMSSGetResiliencyView command class that extends _VMSSVMSShow to retrieve resiliency status for a specific VMSS instance
  • Implemented get_instances_list function to list all VMSS instances with optional resiliency view data
  • Updated command registration to expose the new commands
  • Added comprehensive test coverage for both Flexible and Uniform orchestration modes

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/azure-cli/azure/cli/command_modules/vm/operations/vmss_vms.py Implements the new VMSSGetResiliencyView command class with resiliencyView expansion
src/azure-cli/azure/cli/command_modules/vm/custom.py Adds get_instances_list function with resiliency view support
src/azure-cli/azure/cli/command_modules/vm/commands.py Registers new commands in the command table
src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py Adds test case covering both Flexible and Uniform VMSS orchestration modes
src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_vmss_resiliency_view.yaml Test recording file for the new test

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

# the urlopen is imported for automation purpose
from urllib.request import urlopen # noqa, pylint: disable=import-error,unused-import,ungrouped-imports

from azdev.operations.statistics import command_args_express
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

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

This import appears to be incorrect. command_args_express from azdev.operations.statistics doesn't seem to be used anywhere in the file and shouldn't be imported from azdev (which is a development tool package) in production code.

Suggested change
from azdev.operations.statistics import command_args_express

Copilot uses AI. Check for mistakes.
return args_schema

def pre_operations(self):
self.ctx.args.expand='resiliencyView'
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

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

Missing space after = in the assignment. Should be self.ctx.args.expand = 'resiliencyView' to follow PEP 8 style guidelines.

Suggested change
self.ctx.args.expand='resiliencyView'
self.ctx.args.expand = 'resiliencyView'

Copilot uses AI. Check for mistakes.

instances_id = [instance['instanceId'] for instance in instance_list]
self.kwargs['instance_id'] = instances_id[0]

Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

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

Trailing whitespace on empty line. This should be removed.

Suggested change

Copilot uses AI. Check for mistakes.
@yanzhudd yanzhudd changed the title {VMSS} - Added resiliency view command and argument {Compute}: Add resiliency view command and argument Dec 4, 2025
@yanzhudd yanzhudd changed the title {Compute}: Add resiliency view command and argument {Compute} Add resiliency view command and argument Dec 4, 2025
@yanzhudd
Copy link
Contributor

yanzhudd commented Dec 4, 2025

please refer to the error of breaking-change detector:
image

since you have changed the implementation logic from aaz inheritance to wrapper, you need to make sure this change won't introduce any breaking change.
to do that, you'll need to manually define the parameters in the file https://github.com/Azure/azure-cli/blob/e39ecb40ce04c8341051edcd038ee53b20798a3d/src/azure-cli/azure/cli/command_modules/vm/_params.py, based on the build arguments schema in aaz file:

def _build_arguments_schema(cls, *args, **kwargs):

with self.argument_context('vmss list-instances') as c:
c.argument('virtual_machine_scale_set_name', id_part='virtual_machine_scale_set_name', required=True, options_list=["-n", "--name", "--virtual-machine-scale-set-name"],
help='The name of the VM scale set.')
c.argument('expand', options_list=['--expand'], help="The expand expression to apply to the operation. Allowed values are 'instanceView'.")
Copy link
Contributor

Choose a reason for hiding this comment

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

you don't need to specify the option list if the parameter name is exactly the same as agument name

Suggested change
c.argument('expand', options_list=['--expand'], help="The expand expression to apply to the operation. Allowed values are 'instanceView'.")
c.argument('expand', help="The expand expression to apply to the operation. Allowed values are 'instanceView'.")

help="The filter to apply to the operation. Allowed values are 'startswith(instanceView/statuses/code, 'PowerState') eq true', 'properties/latestModelApplied eq true', 'properties/latestModelApplied eq false'.")
c.argument('select', options_list=['--select'], help="The list parameters. Allowed values are 'instanceView', 'instanceView/statuses'.")
c.argument('resiliency_view', options_list=["--resiliency-view"], help="Show resiliency status of each instance.")
c.argument('pagination_limit', options_list=['--max-items'], arg_group="Pagination",
Copy link
Contributor

Choose a reason for hiding this comment

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

please double check the type of the parameter. If the type is not string, please specify it manually

@yanzhudd
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@yanzhudd yanzhudd merged commit 2170a41 into Azure:dev Dec 18, 2025
48 checks passed
@william051200 william051200 deleted the 32361-update-vmss-command branch December 26, 2025 06:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Auto-Assign Auto assign by bot Compute az vm/vmss/image/disk/snapshot

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Adding command and parameter to VMSS CLI

4 participants