List, update, and delete gallery resources

You can manage your Azure Compute Gallery (formerly known as Shared Image Gallery) resources using the Azure CLI or Azure PowerShell.

List galleries shared with you

List Galleries shared with your subscription.

region=chinanorth
az sig list-shared --location $region 

List Galleries shared with your tenant.

region=chinanorth
az sig list-shared --location $region --shared-to tenant 

The output will contain the public name and uniqueID of the gallery that is shared with you. You can use the name of the gallery to query for images that are available through the gallery.

Here is example output:

[
  {
    "location": "chinanorth",
    "name": "1231b567-8a99-1a2b-1a23-123456789abc-MYDIRECTSHARED",
    "uniqueId": "/SharedGalleries/1231b567-8a99-1a2b-1a23-123456789abc-MYDIRECTSHARED"
  }
]

Update resources

There are some limitations on what can be updated. The following items can be updated:

Azure Compute Gallery:

  • Description

Image definition:

  • Recommended vCPUs
  • Recommended memory
  • Description
  • End of life date

Image version:

  • Regional replica count
  • Target regions
  • Exclusion from latest
  • End of life date

Update the description of a gallery using (az sig update.

az sig update \
   --gallery-name myGallery \
   --resource-group myGalleryRG \
   --set description="My updated description."

Update the description of an image definition using az sig image-definition update.

az sig image-definition update \
   --gallery-name myGallery\
   --resource-group myGalleryRG \
   --gallery-image-definition myImageDefinition \
   --set description="My updated description."

Update an image version to add a region to replicate to using az sig image-version update. This change will take a while as the image gets replicated to the new region.

az sig image-version update \
   --resource-group myGalleryRG \
   --gallery-name myGallery \
   --gallery-image-definition myImageDefinition \
   --gallery-image-version 1.0.0 \
   --add publishingProfile.targetRegions  name=chinanorth

This example shows how to use az sig image-version update to exclude this image version from being used as the latest image.

az sig image-version update \
   --resource-group myGalleryRG \
   --gallery-name myGallery \
   --gallery-image-definition myImageDefinition \
   --gallery-image-version 1.0.0 \
   --set publishingProfile.excludeFromLatest=true

This example shows how to use az sig image-version update to include this image version in being considered for latest image.

az sig image-version update \
   --resource-group myGalleryRG \
   --gallery-name myGallery \
   --gallery-image-definition myImageDefinition \
   --gallery-image-version 1.0.0 \
   --set publishingProfile.excludeFromLatest=false

Delete resources

You have to delete resources in reverse order, by deleting the image version first. After you delete all of the image versions, you can delete the image definition. After you delete all image definitions, you can delete the gallery.

Before you can delete a community shared gallery, you need to use az sig share reset to stop sharing the gallery publicly.

Delete an image version using az sig image-version delete.

az sig image-version delete \
   --resource-group myGalleryRG \
   --gallery-name myGallery \
   --gallery-image-definition myImageDefinition \
   --gallery-image-version 1.0.0 

Delete an image definition using az sig image-definition delete.

az sig image-definition delete \
   --resource-group myGalleryRG \
   --gallery-name myGallery \
   --gallery-image-definition myImageDefinition

Delete a gallery using az sig delete.

az sig delete \
   --resource-group myGalleryRG \
   --gallery-name myGallery