Skip to content

[image-gallery] Migrate commands calling Compute module to aaz-based implementation and removed --marker and --show-next-marker from sig image-definition list-community and sig image-version list-community - #10068

Open
william051200 wants to merge 3 commits into
Azure:mainfrom
william051200:image-gallery-migration

Conversation

@william051200

@william051200 william051200 commented Jul 3, 2026

Copy link
Copy Markdown
Member

🤖 PR Validation — ❌ Action needed

Breaking Changes
❌ 1
❌Azure CLI Extensions Breaking Change Test
❌image-gallery
rule cmd_name rule_message suggest_message
1007 - ParaRemove sig image-definition list-community cmd sig image-definition list-community removed parameter marker please add back parameter marker for cmd sig image-definition list-community
1007 - ParaRemove sig image-definition list-community cmd sig image-definition list-community removed parameter show_next_marker please add back parameter show_next_marker for cmd sig image-definition list-community
1007 - ParaRemove sig image-version list-community cmd sig image-version list-community removed parameter marker please add back parameter marker for cmd sig image-version list-community
1007 - ParaRemove sig image-version list-community cmd sig image-version list-community removed parameter show_next_marker please add back parameter show_next_marker for cmd sig image-version list-community
⚠️ 1006 - ParaAdd sig image-definition list-community cmd sig image-definition list-community added parameter pagination_limit
⚠️ 1006 - ParaAdd sig image-definition list-community cmd sig image-definition list-community added parameter pagination_token
⚠️ 1006 - ParaAdd sig image-version list-community cmd sig image-version list-community added parameter pagination_limit
⚠️ 1006 - ParaAdd sig image-version list-community cmd sig image-version list-community added parameter pagination_token

Migration from mgmt.compute to aaz-based
Replace --marker and --show-next-marker from sig image-definition list-community and sig image-version list-community with --max-items and --next-token. AAZ has its own handling for pagination.


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? (azdev required; see .azure-pipelines/templates/azdev_setup.yml for the install command until azdev==0.2.11b1 is on PyPI)
  • 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 July 3, 2026 02:49
@william051200
william051200 requested a review from yanzhudd as a code owner July 3, 2026 02:49
@azure-client-tools-bot-prd

azure-client-tools-bot-prd Bot commented Jul 3, 2026

Copy link
Copy Markdown
❌Azure CLI Extensions Breaking Change Test
❌image-gallery
rule cmd_name rule_message suggest_message
1007 - ParaRemove sig image-definition list-community cmd sig image-definition list-community removed parameter marker please add back parameter marker for cmd sig image-definition list-community
1007 - ParaRemove sig image-definition list-community cmd sig image-definition list-community removed parameter show_next_marker please add back parameter show_next_marker for cmd sig image-definition list-community
1007 - ParaRemove sig image-version list-community cmd sig image-version list-community removed parameter marker please add back parameter marker for cmd sig image-version list-community
1007 - ParaRemove sig image-version list-community cmd sig image-version list-community removed parameter show_next_marker please add back parameter show_next_marker for cmd sig image-version list-community
⚠️ 1006 - ParaAdd sig image-definition list-community cmd sig image-definition list-community added parameter pagination_limit
⚠️ 1006 - ParaAdd sig image-definition list-community cmd sig image-definition list-community added parameter pagination_token
⚠️ 1006 - ParaAdd sig image-version list-community cmd sig image-version list-community added parameter pagination_limit
⚠️ 1006 - ParaAdd sig image-version list-community cmd sig image-version list-community added parameter pagination_token

@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.

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

This PR migrates the image-gallery extension’s SIG community-related commands away from vendored mgmt.compute SDK usage to AAZ-based implementations provided by azure.cli.command_modules.vm, and updates command registration accordingly.

Changes:

  • Replaced community gallery show/list operations with AAZ-backed wrappers in custom.py.
  • Simplified command table registration to use custom_command for community commands.
  • Removed legacy paging parameters (--marker, --show-next-marker) and removed unused community client factories.

Reviewed changes

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

File Description
src/image-gallery/azext_image_gallery/custom.py Swaps SDK-based community gallery operations for AAZ/VM-module wrappers; updates share enable implementation.
src/image-gallery/azext_image_gallery/commands.py Updates command registration to route community commands through new custom wrappers.
src/image-gallery/azext_image_gallery/_params.py Removes legacy pagination arguments from community list commands.
src/image-gallery/azext_image_gallery/_client_factory.py Deletes now-unused community-specific client factory helpers (keeps galleries factory).

Comment on lines 7 to +21
def load_command_table(self, _):

community_gallery_sdk = CliCommandType(
operations_tmpl='azext_image_gallery.vendored_sdks.azure_mgmt_compute.operations._community_galleries_operations#CommunityGalleriesOperations.{}',
client_factory=cf_community_gallery)

community_gallery_image_sdk = CliCommandType(
operations_tmpl='azext_image_gallery.vendored_sdks.azure_mgmt_compute.operations._community_gallery_images_operations#CommunityGalleryImagesOperations.{}',
client_factory=cf_community_gallery_image)

community_gallery_image_version_sdk = CliCommandType(
operations_tmpl='azext_image_gallery.vendored_sdks.azure_mgmt_compute.operations._community_gallery_image_versions_operations#CommunityGalleryImageVersionsOperations.{}',
client_factory=cf_community_gallery_image_version)

community_gallery_sharing_profile_sdk = CliCommandType(
operations_tmpl='azext_image_gallery.vendored_sdks.azure_mgmt_compute.operations._gallery_sharing_profile_operations#GallerySharingProfileOperations.{}',
client_factory=cf_community_gallery_sharing_profile)

compute_galleries_sdk = CliCommandType(
operations_tmpl='azext_image_gallery.vendored_sdks.azure_mgmt_compute.operations._galleries_operations#GalleriesOperations.{}',
client_factory=cf_galleries,
)

with self.command_group('sig', compute_galleries_sdk, client_factory=cf_galleries) as g:
with self.command_group('sig') as g:
g.custom_command('create', 'create_image_gallery')
g.custom_command('show-community', 'sig_community_gallery_show', is_experimental=True)

with self.command_group('sig', community_gallery_sdk, client_factory=cf_community_gallery) as g:
g.command('show-community', 'get', is_experimental=True)

with self.command_group('sig image-definition', community_gallery_image_sdk,
client_factory=cf_community_gallery_image) as g:
g.command('show-community', 'get', is_experimental=True)
with self.command_group('sig image-definition') as g:
g.custom_command('show-community', 'sig_community_gallery_image_show', is_experimental=True)
g.custom_command('list-community', 'sig_community_image_definition_list', is_experimental=True)

with self.command_group('sig image-version', community_gallery_image_version_sdk,
client_factory=cf_community_gallery_image_version) as g:
g.command('show-community', 'get', is_experimental=True)
with self.command_group('sig image-version') as g:
g.custom_command('show-community', 'sig_community_image_version_show', is_experimental=True)
g.custom_command('list-community', 'sig_community_image_version_list', is_experimental=True)

with self.command_group('sig share', community_gallery_sharing_profile_sdk,
client_factory=cf_community_gallery_sharing_profile) as g:
g.custom_command('enable-community', 'sig_share_update', supports_no_wait=True)
with self.command_group('sig share') as g:
g.custom_command('enable-community', 'sig_share_enable_community', supports_no_wait=True)
Comment on lines +104 to +118
def sig_share_enable_community(cmd, resource_group_name, gallery_name, subscription_ids=None, tenant_ids=None,
no_wait=False, op_type=None):
from azure.cli.command_modules.vm.operations.sig_share import SigShareEnableCommunity
command_args = {
'resource_group': resource_group_name,
'gallery_name': gallery_name,
'no_wait': no_wait,
}
if subscription_ids:
groups.append(SharingProfileGroup(type=SharingProfileGroupTypes.SUBSCRIPTIONS, ids=subscription_ids))
command_args['subscription_ids'] = subscription_ids
if tenant_ids:
groups.append(SharingProfileGroup(type=SharingProfileGroupTypes.AAD_TENANTS, ids=tenant_ids))
sharing_update = SharingUpdate(operation_type=op_type, groups=groups)
return client.begin_update(resource_group_name=resource_group_name,
gallery_name=gallery_name,
sharing_update=sharing_update)
command_args['tenant_ids'] = tenant_ids
if op_type:
command_args['operation_type'] = op_type
return SigShareEnableCommunity(cli_ctx=cmd.cli_ctx)(command_args=command_args)
Comment on lines 39 to 53
with self.argument_context('sig image-definition list-community') as c:
c.argument('location', arg_type=get_location_type(self.cli_ctx), id_part='name')
c.argument('public_gallery_name', public_gallery_name_type)
c.argument('marker', arg_type=marker_type)
c.argument('show_next_marker', action='store_true', help='Show nextMarker in result when specified.')

with self.argument_context('sig image-version show-community') as c:
c.argument('location', arg_type=get_location_type(self.cli_ctx), id_part='name')
c.argument('public_gallery_name', public_gallery_name_type)
c.argument('gallery_image_name', gallery_image_name_type)
c.argument('gallery_image_version_name', gallery_image_name_version_type)

with self.argument_context('sig image-version list-community') as c:
c.argument('location', arg_type=get_location_type(self.cli_ctx), id_part='name')
c.argument('public_gallery_name', public_gallery_name_type)
c.argument('gallery_image_name', gallery_image_name_type)
c.argument('marker', arg_type=marker_type)
c.argument('show_next_marker', action='store_true', help='Show nextMarker in result when specified.')

Comment on lines +16 to +30
def sig_community_image_definition_list(cmd, location, public_gallery_name):
from azure.cli.command_modules.vm.aaz.latest.sig.image_definition import ListCommunity
return ListCommunity(cli_ctx=cmd.cli_ctx)(command_args={
'location': location,
'public_gallery_name': public_gallery_name,
})


def sig_community_image_version_list(client, location, public_gallery_name, gallery_image_name, marker=None,
show_next_marker=None):
generator = client.list(location=location, public_gallery_name=public_gallery_name,
gallery_image_name=gallery_image_name)
return get_page_result(generator, marker, show_next_marker)


def get_page_result(generator, marker, show_next_marker=None):
pages = generator.by_page(continuation_token=marker) # ContainerPropertiesPaged
result = list_generator(pages=pages)

if show_next_marker:
next_marker = {"nextMarker": pages.continuation_token}
result.append(next_marker)
else:
if pages.continuation_token:
logger.warning('Next Marker:')
logger.warning(pages.continuation_token)

return result


# The REST service takes 50 items as a page by default
def list_generator(pages, num_results=50):
result = []

# get first page items
page = list(next(pages))
result += page

while True:
if not pages.continuation_token:
break

# handle num results
if num_results is not None:
if num_results == len(result):
break

page = list(next(pages))
result += page

return result
def sig_community_image_version_list(cmd, location, public_gallery_name, gallery_image_name):
from azure.cli.command_modules.vm.aaz.latest.sig.image_version import ListCommunity
return ListCommunity(cli_ctx=cmd.cli_ctx)(command_args={
'location': location,
'public_gallery_name': public_gallery_name,
'gallery_image_definition': gallery_image_name,
})

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

Copilot reviewed 7 out of 7 changed files in this pull request and generated 9 comments.

Comment thread src/index.json
"version": "1.0.0b3"
},
"sha256Digest": "6e20da857d440f0f6313f27aa674bd1e0581d7d34a5ce599afebf1e383fa0e0c"
"sha256Digest": "642c37950ced20df1be589390f018b525e00333555ca1f995a75c064b600b616"
def sig_community_image_definition_list(client, location, public_gallery_name, marker=None, show_next_marker=None):
generator = client.list(location=location, public_gallery_name=public_gallery_name)
return get_page_result(generator, marker, show_next_marker)
def sig_community_image_definition_list(cmd, location, public_gallery_name):
result += page

return result
def sig_community_image_version_list(cmd, location, public_gallery_name, gallery_image_name):
Comment on lines +39 to +41
def create_image_gallery(cmd, resource_group_name, gallery_name, description=None, location=None,
no_wait=False, tags=None, permissions=None, soft_delete=None, publisher_uri=None,
publisher_contact=None, eula=None, public_name_prefix=None):
return SigCreate(cli_ctx=cmd.cli_ctx)(command_args=command_args)


def sig_community_gallery_show(cmd, location, public_gallery_name):
})


def sig_community_gallery_image_show(cmd, location, public_gallery_name, gallery_image_name):
Comment on lines +93 to +94
def sig_community_image_version_show(cmd, location, public_gallery_name, gallery_image_name,
gallery_image_version_name):
Comment on lines +104 to +105
def sig_share_enable_community(cmd, resource_group_name, gallery_name, subscription_ids=None, tenant_ids=None,
no_wait=False, op_type=None):
Comment thread src/image-gallery/HISTORY.rst Outdated
Comment on lines +8 to +9
* Migrate code from Azure SDK to AAZ based commands for compute operations.
* Remove `--marker` and `--show-next-marker` from `sig image-definition list-community` and `sig image-version list-community`. AAZ have its own handling for pagination.
@william051200
william051200 force-pushed the image-gallery-migration branch from 3bfb23e to b97e7d5 Compare July 3, 2026 06:26
@yanzhudd yanzhudd added minor release extension module with version minor upgraded skip-cal-version labels Jul 3, 2026
@william051200 william051200 added major release extension module with version major upgraded and removed minor release extension module with version minor upgraded labels Jul 3, 2026
@yonzhan yonzhan assigned yanzhudd and william051200 and unassigned yanzhudd Jul 3, 2026
@yonzhan

yonzhan commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

image-gallery

@william051200

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

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

@william051200 william051200 changed the title {image-gallery} Migrate commands calling Compute module to aaz-based implementation [Compute] Migrate commands calling Compute module to aaz-based implementation and removed --marker and --show-next-marker from sig image-definition list-community and sig image-version list-community Jul 5, 2026
@william051200

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

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

@william051200 william051200 changed the title [Compute] Migrate commands calling Compute module to aaz-based implementation and removed --marker and --show-next-marker from sig image-definition list-community and sig image-version list-community [image-gallery] Migrate commands calling Compute module to aaz-based implementation and removed --marker and --show-next-marker from sig image-definition list-community and sig image-version list-community Jul 6, 2026
@william051200

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

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

@yonzhan

yonzhan commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

image-gallery

yanzhudd
yanzhudd previously approved these changes Jul 10, 2026
Comment thread src/image-gallery/HISTORY.rst Outdated
1.1.0
+++++++++++++++
* Migrate code from Azure SDK to AAZ based commands for compute operations.
* Remove `--marker` and `--show-next-marker` from `sig image-definition list-community` and `sig image-version list-community`. AAZ has its own handling for pagination.

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.

It would be better to specify the new parameters for pagination.

@william051200

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

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

@william051200
william051200 force-pushed the image-gallery-migration branch from 1c3ed7e to 53fd028 Compare July 13, 2026 01:28
@william051200 william051200 reopened this Jul 13, 2026
@william051200

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

major release extension module with version major upgraded skip-cal-version

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants