az image

Manage custom virtual machine images.

Commands

az image builder

Manage and build image builder templates.

az image builder cancel

Cancel the long running image build based on the image template.

az image builder create

Create an image builder template.

az image builder customizer

Manage image builder template customizers.

az image builder customizer add

Add an image builder customizer to an image builder template.

az image builder customizer clear

Remove all image builder customizers from an image builder template.

az image builder customizer remove

Remove an image builder customizer from an image builder template.

az image builder delete

Delete image builder template.

az image builder list

List image builder templates.

az image builder output

Manage image builder template output distributors.

az image builder output add

Add an image builder output distributor to an image builder template.

az image builder output clear

Remove all image builder output distributors from an image builder template.

az image builder output remove

Remove an image builder output distributor from an image builder template.

az image builder run

Build an image builder template.

az image builder show

Show an image builder template.

az image builder show-runs

Show an image builder template's run outputs.

az image builder update

Update an image builder template.

az image builder wait

Place the CLI in a waiting state until a condition of the template is met.

az image copy

Copy a managed image (or vm) to other regions. It requires the source disk to be available.

az image create

Create a custom Virtual Machine Image from managed disks or snapshots.

az image delete

Deletes an Image.

az image list

List custom VM images.

az image show

Gets an image.

az image update

Update custom VM images.

az image copy

Copy a managed image (or vm) to other regions. It requires the source disk to be available.

az image copy --source-object-name
              --source-resource-group
              --target-location
              --target-resource-group
              [--cleanup]
              [--export-as-snapshot]
              [--parallel-degree]
              [--source-type {image, vm}]
              [--tags]
              [--target-name]
              [--target-subscription]
              [--temporary-resource-group-name]
              [--timeout]

Examples

Copy an image to several regions and cleanup at the end.

az image copy --source-resource-group mySources-rg --source-object-name myImage \
    --target-location uksouth northeurope --target-resource-group "images-repo-rg" --cleanup

Use an already generalized vm to create images in other regions.

az image copy --source-resource-group mySources-rg --source-object-name myVm \
    --source-type vm --target-location uksouth northeurope --target-resource-group "images-repo-rg"

Required Parameters

--source-object-name

The name of the image or vm resource.

--source-resource-group

Name of the resource group of the source resource.

--target-location

Space separated location list to create the image in (e.g. westeurope etc.).

--target-resource-group

Name of the resource group to create images in.

Optional Parameters

--cleanup

Include this switch to delete temporary resources upon completion.

--export-as-snapshot

Include this switch to export the copies as snapshots instead of images.

--parallel-degree

Number of parallel copy operations.

default value: -1
--source-type

Image or vm.

accepted values: image, vm
default value: image
--tags

Space-separated tags: key[=value] [key[=value] ...]. Use "" to clear existing tags.

--target-name

Name of the final image that will be created.

--target-subscription

Name or ID of the subscription where the final image should be created.

--temporary-resource-group-name --temporary_resource_group_name

Resource Group name where temporary storage account will be created. --temporary_resource_group_name will be deprecated in 0.2.7.

default value: image-copy-rg
--timeout

Time in seconds for the copy operation to finish. Increase this time if you are going to copy large images (disks) like 512GB or more.

default value: 3600

az image create

Create a custom Virtual Machine Image from managed disks or snapshots.

az image create --name
                --resource-group
                --source
                [--data-disk-caching {None, ReadOnly, ReadWrite}]
                [--data-disk-sources]
                [--edge-zone]
                [--hyper-v-generation {V1, V2}]
                [--location]
                [--os-disk-caching {None, ReadOnly, ReadWrite}]
                [--os-type {Linux, Windows}]
                [--storage-sku {Premium_LRS, Premium_ZRS, StandardSSD_LRS, StandardSSD_ZRS, Standard_LRS, UltraSSD_LRS}]
                [--subscription]
                [--tags]
                [--zone-resilient {false, true}]

Examples

Create an image from an existing disk.

az image create -g MyResourceGroup -n image1 --os-type Linux \
    --source /subscriptions/db5eb68e-73e2-4fa8-b18a-0123456789999/resourceGroups/rg1/providers/Microsoft.Compute/snapshots/s1

Create an image by capturing an existing generalized virtual machine in the same resource group.

az image create -g MyResourceGroup -n image1 --source MyVm1

Required Parameters

--name -n

New image name.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--source

OS disk source from the same region, including a virtual machine ID or name, OS disk blob URI, managed OS disk ID or name, or OS snapshot ID or name.

Optional Parameters

--data-disk-caching

Storage caching type for the image's data disk.

accepted values: None, ReadOnly, ReadWrite
--data-disk-sources

Space-separated list of data disk sources, including unmanaged blob URI, managed disk ID or name, or snapshot ID or name.

--edge-zone

The name of edge zone.

--hyper-v-generation

The hypervisor generation of the Virtual Machine created from the image.

accepted values: V1, V2
default value: V1
--location -l

Location. Values from: az account list-locations. You can configure the default location using az configure --defaults location=<location>.

--os-disk-caching

Storage caching type for the image's OS disk.

accepted values: None, ReadOnly, ReadWrite
--os-type
accepted values: Linux, Windows
--storage-sku

The SKU of the storage account with which to create the VM image. Unused if source VM is specified.

accepted values: Premium_LRS, Premium_ZRS, StandardSSD_LRS, StandardSSD_ZRS, Standard_LRS, UltraSSD_LRS
--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--tags

Space-separated tags: key[=value] [key[=value] ...]. Use "" to clear existing tags.

--zone-resilient

Specifies whether an image is zone resilient or not. Default is false. Zone resilient images can be created only in regions that provide Zone Redundant Storage.

accepted values: false, true

az image delete

Deletes an Image.

az image delete [--ids]
                [--name]
                [--resource-group]
                [--subscription]

Optional Parameters

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--name -n

The name of the image.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

az image list

List custom VM images.

az image list [--query-examples]
              [--resource-group]
              [--subscription]

Optional Parameters

--query-examples

Recommend JMESPath string for you. You can copy one of the query and paste it after --query parameter within double quotation marks to see the results. You can add one or more positional keywords so that we can give suggestions based on these key words.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

az image show

Gets an image.

az image show [--expand]
              [--ids]
              [--name]
              [--query-examples]
              [--resource-group]
              [--subscription]

Optional Parameters

--expand

The expand expression to apply on the operation.

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--name -n

The name of the image.

--query-examples

Recommend JMESPath string for you. You can copy one of the query and paste it after --query parameter within double quotation marks to see the results. You can add one or more positional keywords so that we can give suggestions based on these key words.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

az image update

Update custom VM images.

az image update [--add]
                [--force-string]
                [--ids]
                [--name]
                [--remove]
                [--resource-group]
                [--set]
                [--subscription]
                [--tags]

Examples

Add or update tags.

az image update -n ImageName -g ResourceGroup --tags tag1=val1 tag2=val2

Remove all tags.

az image update -n ImageName -g resourceGroup --tags

Optional Parameters

--add

Add an object to a list of objects by specifying a path and key value pairs. Example: --add property.listProperty <key=value, string or JSON string>.

--force-string

When using 'set' or 'add', preserve string literals instead of attempting to convert to JSON.

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--name -n

The name of the image.

--remove

Remove a property or an element from a list. Example: --remove property.list OR --remove propertyToRemove.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--set

Update an object by specifying a property path and value to set. Example: --set property1.property2=.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--tags

Space-separated tags: key[=value] [key[=value] ...]. Use "" to clear existing tags.