LinuxCommandLibrary

az-image

Manage virtual machine images in Azure

TLDR

List the custom images under a resource group

$ az image list [[-g|--resource-group]] [resource_group]
copy

Create a custom image from managed disks or snapshots
$ az image create [[-g|--resource-group]] [resource_group] [[-n|--name]] [name] --os-type [windows|linux] --source [os_disk_source]
copy

Delete a custom image
$ az image delete [[-n|--name]] [name] [[-g|--resource-group]] [resource_group]
copy

Show details of a custom image
$ az image show [[-n|--name]] [name] [[-g|--resource-group]] [resource_group]
copy

Update custom images
$ az image update [[-n|--name]] [name] [[-g|--resource-group]] [resource_group] --set [property=value]
copy

SYNOPSIS

az image { create | delete | list | show | update } [options]

PARAMETERS

--resource-group, -g
    Name of the resource group.

--name, -n
    Name of the image.

--source
    Source VM, storage blob, managed image, or snapshot for creation.

--os-type
    linux or windows OS type (create only).

--hyper-v-generation
    Gen1 or Gen2 (create only).

--location, -l
    Azure region for the image.

--tags
    Space-separated tags in 'key=value' format.

--output, -o
    Output format (json, table, tsv, etc.).

--query
    JMESPath query string for output filtering.

--no-wait
    Do not wait for completion.

DESCRIPTION

az image is a command group in the Azure Command-Line Interface (CLI), a cross-platform tool for managing Azure resources from the Linux terminal. It enables creation, listing, viewing, updating, and deletion of custom virtual machine (VM) images.

Azure VM images serve as templates for deploying consistent VMs with pre-configured OS and software. Use az image create to generalize a VM snapshot into a reusable image, ideal for scaling deployments. az image list retrieves images in a resource group or subscription, supporting filtering by tags or location.

Key use cases include custom OS images for enterprise environments, disaster recovery, or CI/CD pipelines. Images can be managed across regions for high availability. Requires Azure authentication via az login and appropriate RBAC permissions like Contributor on the resource group.

Integrates with Shared Image Gallery (SIG) via az sig image for versioned, replicated images. Outputs JSON by default, customizable with --query and --output. Efficient for automation in scripts or DevOps workflows, reducing VM provisioning time.

CAVEATS

Requires Azure CLI ≥2.0, az login, and permissions. Images must be generalized before creation. Cannot update source after creation. Regional replication handled via SIG, not basic images.
Limits: 1000 images per subscription per region.

COMMON SUBCOMMANDS

az image create: From VM/snapshot.
az image list: [--all|--gallery-image-definition].
az image show: Details by name/group.
az image delete: Permanent removal.

EXAMPLE

az image create --resource-group myGroup --name myImage --source myVM

HISTORY

Introduced in Azure CLI 2.0 (2017). Enhanced in 2.10+ for SIG support, better query options. Evolved with Azure features like confidential VMs (2021+).

SEE ALSO

az vm(1), az snapshot(1), az sig image(1), az disk(1)

Copied to clipboard