Skip to content

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

Merged
Julie Zhu (yanzhudd) merged 6 commits into
Azure:mainfrom
william051200:ssh-migration
Jun 11, 2026
Merged

{SSH} Migrate commands calling Compute module to aaz-based implementation#9778
Julie Zhu (yanzhudd) merged 6 commits into
Azure:mainfrom
william051200:ssh-migration

Conversation

@william051200

@william051200 William (william051200) commented Apr 13, 2026

Copy link
Copy Markdown
Member

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

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

Copy link
Copy Markdown
️✔️Azure CLI Extensions Breaking Change Test
️✔️Non Breaking Changes

@azure-client-tools-bot-prd

Copy link
Copy Markdown

Hi William (@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

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

github-actions Bot commented Apr 13, 2026

Copy link
Copy Markdown
Contributor

@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

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.

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']

Copilot AI Apr 13, 2026

Copy link

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)

Copilot AI Apr 13, 2026

Copy link

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
@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 29, 2026
@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 29, 2026
Comment thread src/ssh/azext_ssh/ip_utils.py Outdated
vm_client = compute_client.virtual_machines
from .aaz.latest.network.public_ip import Show as PublicIpShow
from .aaz.latest.network.nic import Show as InterfaceShow
from azure.cli.command_modules.vm.aaz.latest.vm import Show as VMShow

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.

please use the overriden VMShow under the operations folder, as it already includes a fix for a deserialization issue

Comment thread src/ssh/azext_ssh/target_os_utils.py Outdated
from azure.cli.core.commands import client_factory
from azure.cli.core import profiles
vm = None
from azure.cli.command_modules.vm.aaz.latest.vm import Show as VMShow

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.

the same as above

@william051200

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 2 pipeline(s).

@yanzhudd
Julie Zhu (yanzhudd) merged commit 231ab1b into Azure:main Jun 11, 2026
24 checks passed
@azclibot

Copy link
Copy Markdown
Collaborator

[Release] Update index.json for extension [ ssh-2.0.9 ] : https://dev.azure.com/msazure/One/_build/results?buildId=167603859&view=results

@william051200
William (william051200) deleted the ssh-migration branch June 12, 2026 07:49
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.

5 participants