[Compute] az vmss lifecycle-hook/ lifecycle-hook-event: Add new command groups to support vmss lifecycle hooks#33758
Open
william051200 wants to merge 13 commits into
Open
[Compute] az vmss lifecycle-hook/ lifecycle-hook-event: Add new command groups to support vmss lifecycle hooks#33758william051200 wants to merge 13 commits into
az vmss lifecycle-hook/ lifecycle-hook-event: Add new command groups to support vmss lifecycle hooks#33758william051200 wants to merge 13 commits into
Conversation
|
Hi @william051200, |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
az vmss lifecycle-hooks &az vmss lifecycle-hooks-event: Add new command groups to support vmss lifecycle hooksaz vmss lifecycle-hooks/ lifecycle-hooks-event: Add new command groups to support vmss lifecycle hooks
az vmss lifecycle-hooks/ lifecycle-hooks-event: Add new command groups to support vmss lifecycle hooksaz vmss lifecycle-hook/ lifecycle-hook-event: Add new command groups to support vmss lifecycle hooks
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds new preview command groups under the vmss command module to manage VM Scale Set lifecycle hooks and to interact with platform-generated lifecycle hook events, along with scenario tests and recordings.
Changes:
- Add
az vmss lifecycle-hookcommands (add/update/remove/show/list) backed by new custom implementations. - Add
az vmss lifecycle-hook-eventcommands, including AAZ-generated list/show/update and custom wrappers for update/approve/reject with client-side validation. - Add scenario tests and a recording to validate core command behaviors.
Reviewed changes
Copilot reviewed 12 out of 13 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/tests/latest/test_vm_commands.py | Adds scenario tests for lifecycle-hook and lifecycle-hook-event command groups. |
| src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_vmss_lifecycle_hook_event.yaml | Adds recording for lifecycle-hook-event list scenario. |
| src/azure-cli/azure/cli/command_modules/vm/custom.py | Implements lifecycle hook CRUD and lifecycle hook event update/approve/reject helpers. |
| src/azure-cli/azure/cli/command_modules/vm/commands.py | Registers new command groups and wires validators. |
| src/azure-cli/azure/cli/command_modules/vm/aaz/latest/vmss/lifecycle_hook_event/_update.py | Adds AAZ-generated vmss lifecycle-hook-event update. |
| src/azure-cli/azure/cli/command_modules/vm/aaz/latest/vmss/lifecycle_hook_event/_show.py | Adds AAZ-generated vmss lifecycle-hook-event show. |
| src/azure-cli/azure/cli/command_modules/vm/aaz/latest/vmss/lifecycle_hook_event/_list.py | Adds AAZ-generated vmss lifecycle-hook-event list. |
| src/azure-cli/azure/cli/command_modules/vm/aaz/latest/vmss/lifecycle_hook_event/init.py | Exposes lifecycle_hook_event AAZ commands for loading. |
| src/azure-cli/azure/cli/command_modules/vm/aaz/latest/vmss/lifecycle_hook_event/__cmd_group.py | Registers the AAZ command group for lifecycle hook events. |
| src/azure-cli/azure/cli/command_modules/vm/_validators.py | Adds validators for hook removal and lifecycle-hook-event update/action behaviors. |
| src/azure-cli/azure/cli/command_modules/vm/_params.py | Adds argument definitions/enums for lifecycle hook and lifecycle hook event commands. |
| src/azure-cli/azure/cli/command_modules/vm/_help.py | Adds help content for the new command groups/commands. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # AZURE CLI VM TEST DEFINITIONS | ||
| import json | ||
| import os | ||
| import datetime |
Comment on lines
+5123
to
+5131
| def _commit_vmss_lifecycle_hooks(cmd, resource_group_name, vmss_name, hooks, no_wait): | ||
| from .operations.vmss import VMSSCreate, convert_show_result_to_snake_case | ||
| vmss = get_vmss_modified_by_aaz(cmd, resource_group_name, vmss_name) | ||
| vmss = convert_show_result_to_snake_case(vmss) | ||
| vmss["lifecycle_hooks_profile"] = {"lifecycle_hooks": hooks} | ||
| vmss["resource_group"] = resource_group_name | ||
| vmss["vm_scale_set_name"] = vmss_name | ||
| vmss["no_wait"] = no_wait | ||
| return VMSSCreate(cli_ctx=cmd.cli_ctx)(command_args=vmss) |
Comment on lines
+3079
to
+3082
| helps['vmss lifecycle-hook-event'] = """ | ||
| type: group | ||
| short-summary: Manage virtual machine scale set lifecycle hook events. | ||
| """ |
az vmss lifecycle-hook/ lifecycle-hook-event: Add new command groups to support vmss lifecycle hooksaz vmss lifecycle-hook/ lifecycle-hook-event: Add new command groups to support vmss lifecycle hooks
Collaborator
|
Compute |
Member
Author
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
Member
Author
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
Member
|
AnshulVermaa
suggested changes
Jul 23, 2026
AnshulVermaa
left a comment
Member
There was a problem hiding this comment.
Comments added in discussions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related command
az vmss lifecycle-hook add/list/remove/show/updateaz vmss lifecycle-hook-event approve/list/reject/show/updateDescription
Resolve #33652
aaz Azure/aaz#1046
Testing Guide
Refer to
azure-cli\src\azure-cli\azure\cli\command_modules\vm\tests\latest\test_vm_commands.py:test_vmss_lifecycle_hooktest_vmss_lifecycle_hook_eventaz vmss lifecycle-hook-event approve/reject/updateare not included in the test cases as they required live platform-generated event. Service team will be helping with the test locally.History Notes
[Compute]
az vmss lifecycle-hook/ lifecycle-hook-event: Add new command groups to support vmss lifecycle hooksThis checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.
🤖 PR Validation —⚠️ Review suggested