az image

Note

This reference is part of the image-copy-extension extension for the Azure CLI (version 2.68.0 or higher). The extension will automatically install the first time you run an az image command. Learn more about extensions.

Manage custom virtual machine images.

Commands

Name Description Type Status
az image copy

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

Extension GA

az image copy

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

Azure CLI
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.

Azure CLI
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.

Azure CLI
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.

Default value: False
--export-as-snapshot

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

Default value: False
--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

Resource Group name where temporary storage account will be created.

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
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

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

--verbose

Increase logging verbosity. Use --debug for full debug logs.