Skip to content

{SSH} Migrate commands calling Compute module to aaz-based implementation#9778

Open
william051200 wants to merge 3 commits intoAzure:mainfrom
william051200:ssh-migration
Open

{SSH} Migrate commands calling Compute module to aaz-based implementation#9778
william051200 wants to merge 3 commits intoAzure:mainfrom
william051200:ssh-migration

Conversation

@william051200
Copy link
Copy Markdown
Member

@william051200 william051200 commented Apr 13, 2026

Migration from mgmt.compute to aaz-based


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

Related command

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 April 13, 2026 23:45
@azure-client-tools-bot-prd
Copy link
Copy Markdown

azure-client-tools-bot-prd bot commented Apr 13, 2026

️✔️Azure CLI Extensions Breaking Change Test
️✔️Non Breaking Changes

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

Hi @william051200,
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 Apr 13, 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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 13, 2026

@github-actions github-actions bot added the release-version-block Updates do not qualify release version rules. NOTE: please do not edit it manually. label Apr 13, 2026
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

Migrates the ssh extension’s Azure VM compute lookups from the management SDK (mgmt.compute) to AAZ-based command implementations, aligning compute operations with the extension’s existing AAZ usage.

Changes:

  • Bump ssh extension version to 2.0.7 and add release notes.
  • Switch Azure VM “show” calls to AAZ (azure.cli.command_modules.vm.aaz...) and update downstream field access to dict-style.
  • Update VM NIC enumeration logic to read from AAZ VM output shape.

Reviewed changes

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

File Description
src/ssh/setup.py Version bump to reflect the migration release.
src/ssh/azext_ssh/target_os_utils.py Replace mgmt compute VM GET with AAZ VM Show; adjust OS type extraction.
src/ssh/azext_ssh/ip_utils.py Replace mgmt compute VM GET with AAZ VM Show; adjust NIC reference iteration.
src/ssh/HISTORY.md Add 2.0.7 release entry describing the compute migration.

Comment on lines +66 to +67
if vm and vm.get('storageProfile', {}).get('osDisk', {}).get('osType'):
os_type = vm['storageProfile']['osDisk']['osType']
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

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

Add/update unit tests for _get_azure_vm_os to cover the new AAZ-based VM retrieval (successful OS type extraction and the exception path). test_target_os_utils.py currently covers Arc/VMware but not Azure VM, so this change can regress silently if the AAZ output shape or invocation changes.

Suggested change
if vm and vm.get('storageProfile', {}).get('osDisk', {}).get('osType'):
os_type = vm['storageProfile']['osDisk']['osType']
if vm:
os_type = vm.get('storageProfile', {}).get('osDisk', {}).get('osType')

Copilot uses AI. Check for mistakes.
Comment thread src/ssh/HISTORY.md
===============
2.0.7
-----
* Migrate code from Azure SDK to AAZ based commands for compute operations (VM)
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

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

Release note wording: consider hyphenating "AAZ-based" (compound modifier) for readability/consistency.

Suggested change
* Migrate code from Azure SDK to AAZ based commands for compute operations (VM)
* Migrate code from Azure SDK to AAZ-based commands for compute operations (VM)

Copilot uses AI. Check for mistakes.
@github-actions github-actions bot removed the release-version-block Updates do not qualify release version rules. NOTE: please do not edit it manually. label Apr 14, 2026
@yonzhan yonzhan requested a review from yanzhudd April 16, 2026 04:17
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