Skip to content

{Compute} az sshkey: Migrate command group to aaz-based implementation - #34125

Open
William (william051200) wants to merge 8 commits into
Azure:devfrom
william051200:migrate-ssh
Open

William (william051200) wants to merge 8 commits into
Azure:devfrom
william051200:migrate-ssh

Conversation

@william051200

@william051200 William (william051200) commented Sep 24, 2026 •

Copy link
Copy Markdown
Member

🤖 PR Validation — ⚠️ Review suggested

Breaking Changes Tests
⚠️ None ️✔️ 130/130
⚠️AzureCLI-BreakingChangeTest
⚠️vm
rule cmd_name rule_message suggest_message
⚠️ 1008 - ParaPropAdd sshkey create cmd sshkey create update parameter encryption_type: added property aaz_default=RSA
⚠️ 1008 - ParaPropAdd sshkey create cmd sshkey create update parameter encryption_type: added property aaz_type=string
⚠️ 1008 - ParaPropAdd sshkey create cmd sshkey create update parameter encryption_type: added property type=string
⚠️ 1008 - ParaPropAdd sshkey create cmd sshkey create update parameter location: added property aaz_type=string
⚠️ 1010 - ParaPropUpdate sshkey create cmd sshkey create update parameter location: updated property type from custom_type to string
⚠️ 1008 - ParaPropAdd sshkey create cmd sshkey create update parameter public_key: added property aaz_type=string
⚠️ 1008 - ParaPropAdd sshkey create cmd sshkey create update parameter resource_group_name: added property aaz_type=string
⚠️ 1008 - ParaPropAdd sshkey create cmd sshkey create update parameter resource_group_name: added property type=string
⚠️ 1010 - ParaPropUpdate sshkey create cmd sshkey create update parameter resource_group_name: updated property name from resource_group_name to resource_group
⚠️ 1008 - ParaPropAdd sshkey create cmd sshkey create update parameter ssh_public_key_name: added property aaz_type=string
⚠️ 1008 - ParaPropAdd sshkey create cmd sshkey create update parameter tags: added property aaz_type=AAZDictArg
⚠️ 1008 - ParaPropAdd sshkey create cmd sshkey create update parameter tags: added property type=Dict<String,String>
⚠️ 1010 - ParaPropUpdate sshkey create cmd sshkey create update parameter tags: updated property nargs from * to +
⚠️ 1004 - CmdPropRemove sshkey delete cmd sshkey delete removed property confirmation
⚠️ 1008 - ParaPropAdd sshkey delete cmd sshkey delete update parameter resource_group_name: added property aaz_type=string
⚠️ 1008 - ParaPropAdd sshkey delete cmd sshkey delete update parameter resource_group_name: added property type=string
⚠️ 1010 - ParaPropUpdate sshkey delete cmd sshkey delete update parameter resource_group_name: updated property name from resource_group_name to resource_group
⚠️ 1008 - ParaPropAdd sshkey delete cmd sshkey delete update parameter ssh_public_key_name: added property aaz_type=string
⚠️ 1006 - ParaAdd sshkey list cmd sshkey list added parameter pagination_limit
⚠️ 1006 - ParaAdd sshkey list cmd sshkey list added parameter pagination_token
⚠️ 1008 - ParaPropAdd sshkey list cmd sshkey list update parameter resource_group_name: added property aaz_type=string
⚠️ 1008 - ParaPropAdd sshkey list cmd sshkey list update parameter resource_group_name: added property type=string
⚠️ 1010 - ParaPropUpdate sshkey list cmd sshkey list update parameter resource_group_name: updated property name from resource_group_name to resource_group
⚠️ 1008 - ParaPropAdd sshkey show cmd sshkey show update parameter resource_group_name: added property aaz_type=string
⚠️ 1008 - ParaPropAdd sshkey show cmd sshkey show update parameter resource_group_name: added property type=string
⚠️ 1010 - ParaPropUpdate sshkey show cmd sshkey show update parameter resource_group_name: updated property name from resource_group_name to resource_group
⚠️ 1008 - ParaPropAdd sshkey show cmd sshkey show update parameter ssh_public_key_name: added property aaz_type=string
⚠️ 1008 - ParaPropAdd sshkey update cmd sshkey update update parameter public_key: added property aaz_type=string
⚠️ 1008 - ParaPropAdd sshkey update cmd sshkey update update parameter resource_group_name: added property aaz_type=string
⚠️ 1008 - ParaPropAdd sshkey update cmd sshkey update update parameter resource_group_name: added property type=string
⚠️ 1010 - ParaPropUpdate sshkey update cmd sshkey update update parameter resource_group_name: updated property name from resource_group_name to resource_group
⚠️ 1008 - ParaPropAdd sshkey update cmd sshkey update update parameter ssh_public_key_name: added property aaz_type=string
⚠️ 1008 - ParaPropAdd sshkey update cmd sshkey update update parameter tags: added property aaz_type=AAZDictArg
⚠️ 1008 - ParaPropAdd sshkey update cmd sshkey update update parameter tags: added property type=Dict<String,String>
⚠️ 1010 - ParaPropUpdate sshkey update cmd sshkey update update parameter tags: updated property nargs from * to +

Related command

az sshkey create/list/show/update/delete

Description

Updated src/azure-cli/azure/cli/command_modules/vm/__init__.py to prevent overwriting from generated & manual code.

Migration from mgmt.compute to aaz-based

aaz Azure/aaz#1104

Testing Guide

History Notes


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

Copilot AI lite review requested due to automatic review settings September 24, 2026 03:06
@azure-client-tools-bot-prd

Copy link
Copy Markdown

Hi William (@william051200),
Since the current milestone time is less than 7 days, this pr will be reviewed in the next milestone.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Preserve generic update options and write private keys with restrictive permissions.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 High severity

Open (1)
What changed in this PR

Migrates az sshkey CRUD commands to AAZ while preserving custom key-pair generation and preventing legacy loader overwrites.

Changes:

  • Adds AAZ SSH key commands and registrations.
  • Adds custom key generation and persistence.
  • Updates command loading and scenario tests.
File Description
src/​azure-cli/​azure/​cli/​command_modules/​vm/​tests/​latest/​test_vm_commands.py Updates SSH key scenario coverage.
src/​azure-cli/​azure/​cli/​command_modules/​vm/​operations/​sshkey.py Implements custom creation and key-pair persistence.
src/​azure-cli/​azure/​cli/​command_modules/​vm/​commands.py Registers the custom create command.
src/​azure-cli/​azure/​cli/​command_modules/​vm/​aaz/​latest/​sshkey/​_update.py Provides the AAZ update operation.
src/​azure-cli/​azure/​cli/​command_modules/​vm/​aaz/​latest/​sshkey/​_show.py Provides the AAZ show operation.
src/​azure-cli/​azure/​cli/​command_modules/​vm/​aaz/​latest/​sshkey/​_list.py Provides the AAZ list operation.
src/​azure-cli/​azure/​cli/​command_modules/​vm/​aaz/​latest/​sshkey/​_generate_key_pair.py Provides key-pair generation.
src/​azure-cli/​azure/​cli/​command_modules/​vm/​aaz/​latest/​sshkey/​_delete.py Provides the AAZ delete operation.
src/​azure-cli/​azure/​cli/​command_modules/​vm/​aaz/​latest/​sshkey/​_create.py Provides the AAZ create operation.
src/​azure-cli/​azure/​cli/​command_modules/​vm/​aaz/​latest/​sshkey/​__init__.py Initializes SSH key commands.
src/​azure-cli/​azure/​cli/​command_modules/​vm/​aaz/​latest/​sshkey/​__cmd_group.py Registers the SSH key command group.
src/​azure-cli/​azure/​cli/​command_modules/​vm/​__init__.py Prevents legacy loaders from overwriting generated commands.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

private_key_file = str(ssh_path.joinpath(str(time.time()).replace(".", "_")))
public_key_file = private_key_file + ".pub"

with open(private_key_file, "w", newline="\n") as file:
@yonzhan

Copy link
Copy Markdown
Collaborator

Compute

This branch has not been deployed

No deployments
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.

3 participants