az image
Note
This command group has commands that are defined in both Azure CLI and at least one extension. Install each extension to benefit from its extended capabilities. Learn more about extensions.
Manage custom virtual machine images.
Commands
Name | Description | Type | Status |
---|---|---|---|
az image builder |
Manage and build image builder templates. |
Core | GA |
az image builder cancel |
Cancel the long running image build based on the image template. |
Core | GA |
az image builder create |
Create an image builder template. |
Core | GA |
az image builder customizer |
Manage image builder template customizers. |
Core | GA |
az image builder customizer add |
Add an image builder customizer to an image builder template. |
Core | GA |
az image builder customizer clear |
Remove all image builder customizers from an image builder template. |
Core | GA |
az image builder customizer remove |
Remove an image builder customizer from an image builder template. |
Core | GA |
az image builder delete |
Delete image builder template. |
Core | GA |
az image builder error-handler |
Manage image builder template error handler. |
Core | GA |
az image builder error-handler add |
Add error handler to an existing image builder template. |
Core | GA |
az image builder error-handler remove |
Remove error handler from an existing image builder template. |
Core | GA |
az image builder error-handler show |
Show error handler of an existing image builder template. |
Core | GA |
az image builder identity |
Manage identities of an image builder template. |
Core | GA |
az image builder identity assign |
Add managed identities to an existing image builder template. Currently, only one user identity is supported. |
Core | GA |
az image builder identity remove |
Remove managed identities from an existing image builder template. |
Core | GA |
az image builder identity show |
Display managed identities of a image builder template. |
Core | GA |
az image builder list |
List image builder templates. |
Core | GA |
az image builder optimizer |
Manage image builder template optimizer. |
Core | GA |
az image builder optimizer add |
Add optimizer to an existing image builder template. |
Core | GA |
az image builder optimizer remove |
Remove optimizer from an existing image builder template. |
Core | GA |
az image builder optimizer show |
Show optimizer of an existing image builder template. |
Core | GA |
az image builder optimizer update |
Update an optimizer from an existing image builder template. |
Core | GA |
az image builder output |
Manage image builder template output distributors. |
Core | GA |
az image builder output add |
Add an image builder output distributor to an image builder template. |
Core | GA |
az image builder output clear |
Remove all image builder output distributors from an image builder template. |
Core | GA |
az image builder output remove |
Remove an image builder output distributor from an image builder template. |
Core | GA |
az image builder output versioning |
Manage image builder template output versioner. |
Core | GA |
az image builder output versioning remove |
Remove all versioning options on specified outputs. |
Core | GA |
az image builder output versioning set |
Set the image builder output versioner of an image builder template. |
Core | GA |
az image builder output versioning show |
Show versioning options on specified outputs. |
Core | GA |
az image builder run |
Build an image builder template. |
Core | GA |
az image builder show |
Show an image builder template. |
Core | GA |
az image builder show-runs |
Show an image builder template's run outputs. |
Core | GA |
az image builder trigger |
Manage image builder template trigger. |
Core | GA |
az image builder trigger create |
Create a trigger for the specified virtual machine image template. |
Core | GA |
az image builder trigger delete |
Delete a trigger for the specified virtual machine image template. |
Core | GA |
az image builder trigger list |
List all triggers for the specified Image Template resource. |
Core | GA |
az image builder trigger show |
Get the specified trigger for the specified image template resource. |
Core | GA |
az image builder trigger wait |
Place the CLI in a waiting state until a condition is met. |
Core | GA |
az image builder update |
Update an image builder template. |
Core | GA |
az image builder validator |
Manage image builder template validate. |
Core | GA |
az image builder validator add |
Add validate to an existing image builder template. |
Core | GA |
az image builder validator remove |
Remove validate from an existing image builder template. |
Core | GA |
az image builder validator show |
Show validate of an existing image builder template. |
Core | GA |
az image builder wait |
Place the CLI in a waiting state until a condition of the template is met. |
Core | GA |
az image copy |
Copy a managed image (or vm) to other regions. It requires the source disk to be available. |
Extension | GA |
az image create |
Create a custom Virtual Machine Image from managed disks or snapshots. |
Core | GA |
az image delete |
Delete an Image. |
Core | GA |
az image list |
List the list of images under a resource group. |
Core | GA |
az image show |
Get an image. |
Core | GA |
az image update |
Update custom VM images. |
Core | GA |
az image wait |
Place the CLI in a waiting state until a condition is met. |
Core | GA |
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
The name of the image or vm resource.
Name of the resource group of the source resource.
Space separated location list to create the image in (e.g. westeurope etc.).
Name of the resource group to create images in.
Optional Parameters
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
Include this switch to delete temporary resources upon completion.
Property | Value |
---|---|
Default value: | False |
Include this switch to export the copies as snapshots instead of images.
Property | Value |
---|---|
Default value: | False |
Number of parallel copy operations.
Property | Value |
---|---|
Default value: | -1 |
Image or vm.
Property | Value |
---|---|
Default value: | image |
Accepted values: | image, vm |
Space-separated tags: key[=value] [key[=value] ...]. Use "" to clear existing tags.
Name of the final image that will be created.
Name or ID of the subscription where the final image should be created.
Resource Group name where temporary storage account will be created.
Property | Value |
---|---|
Default value: | image-copy-rg |
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.
Property | Value |
---|---|
Default value: | 3600 |
Global Parameters
Increase logging verbosity to show all debug logs.
Property | Value |
---|---|
Default value: | False |
Show this help message and exit.
Only show errors, suppressing warnings.
Property | Value |
---|---|
Default value: | False |
Output format.
Property | Value |
---|---|
Default value: | json |
Accepted values: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.
Property | Value |
---|---|
Default value: | False |
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 {PremiumV2_LRS, Premium_LRS, Premium_ZRS, StandardSSD_LRS, StandardSSD_ZRS, Standard_LRS, UltraSSD_LRS}]
[--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
New image name.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
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
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
Storage caching type for the image's data disk.
Property | Value |
---|---|
Accepted values: | None, ReadOnly, ReadWrite |
Space-separated list of data disk sources, including unmanaged blob URI, managed disk ID or name, or snapshot ID or name.
The name of edge zone.
The hypervisor generation of the Virtual Machine created from the image.
Property | Value |
---|---|
Default value: | V1 |
Accepted values: | V1, V2 |
Location. Values from: az account list-locations
. You can configure the default location using az configure --defaults location=<location>
.
Storage caching type for the image's OS disk.
Property | Value |
---|---|
Accepted values: | None, ReadOnly, ReadWrite |
Property | Value |
---|---|
Accepted values: | Linux, Windows |
The SKU of the storage account with which to create the VM image. Unused if source VM is specified.
Property | Value |
---|---|
Accepted values: | PremiumV2_LRS, Premium_LRS, Premium_ZRS, StandardSSD_LRS, StandardSSD_ZRS, Standard_LRS, UltraSSD_LRS |
Space-separated tags: key[=value] [key[=value] ...]. Use "" to clear existing tags.
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.
Property | Value |
---|---|
Accepted values: | false, true |
Global Parameters
Increase logging verbosity to show all debug logs.
Property | Value |
---|---|
Default value: | False |
Show this help message and exit.
Only show errors, suppressing warnings.
Property | Value |
---|---|
Default value: | False |
Output format.
Property | Value |
---|---|
Default value: | json |
Accepted values: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
Property | Value |
---|---|
Default value: | False |
az image delete
Delete an Image.
az image delete [--ids]
[--image-name --name]
[--no-wait {0, 1, f, false, n, no, t, true, y, yes}]
[--resource-group]
[--subscription]
Optional Parameters
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
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.
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
The name of the image.
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Do not wait for the long-running operation to finish.
Property | Value |
---|---|
Accepted values: | 0, 1, f, false, n, no, t, true, y, yes |
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Global Parameters
Increase logging verbosity to show all debug logs.
Property | Value |
---|---|
Default value: | False |
Show this help message and exit.
Only show errors, suppressing warnings.
Property | Value |
---|---|
Default value: | False |
Output format.
Property | Value |
---|---|
Default value: | json |
Accepted values: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.
Property | Value |
---|---|
Default value: | False |
az image list
List the list of images under a resource group.
az image list [--max-items]
[--next-token]
[--resource-group]
Optional Parameters
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
Total number of items to return in the command's output. If the total number of items available is more than the value specified, a token is provided in the command's output. To resume pagination, provide the token value in --next-token
argument of a subsequent command.
Property | Value |
---|---|
Parameter group: | Pagination Arguments |
Token to specify where to start paginating. This is the token value from a previously truncated response.
Property | Value |
---|---|
Parameter group: | Pagination Arguments |
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Global Parameters
Increase logging verbosity to show all debug logs.
Property | Value |
---|---|
Default value: | False |
Show this help message and exit.
Only show errors, suppressing warnings.
Property | Value |
---|---|
Default value: | False |
Output format.
Property | Value |
---|---|
Default value: | json |
Accepted values: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
Property | Value |
---|---|
Default value: | False |
az image show
Get an image.
az image show [--expand]
[--ids]
[--image-name --name]
[--resource-group]
[--subscription]
Optional Parameters
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
The expand expression to apply on the operation.
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.
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
The name of the image.
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Global Parameters
Increase logging verbosity to show all debug logs.
Property | Value |
---|---|
Default value: | False |
Show this help message and exit.
Only show errors, suppressing warnings.
Property | Value |
---|---|
Default value: | False |
Output format.
Property | Value |
---|---|
Default value: | json |
Accepted values: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.
Property | Value |
---|---|
Default value: | False |
az image update
Update custom VM images.
az image update [--add]
[--force-string {0, 1, f, false, n, no, t, true, y, yes}]
[--ids]
[--image-name --name]
[--no-wait {0, 1, f, false, n, no, t, true, y, yes}]
[--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
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
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>
.
Property | Value |
---|---|
Parameter group: | Generic Update Arguments |
When using 'set' or 'add', preserve string literals instead of attempting to convert to JSON.
Property | Value |
---|---|
Parameter group: | Generic Update Arguments |
Accepted values: | 0, 1, f, false, n, no, t, true, y, yes |
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.
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
The name of the image.
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Do not wait for the long-running operation to finish.
Property | Value |
---|---|
Accepted values: | 0, 1, f, false, n, no, t, true, y, yes |
Remove a property or an element from a list. Example: --remove property.list <indexToRemove>
OR --remove propertyToRemove
.
Property | Value |
---|---|
Parameter group: | Generic Update Arguments |
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Update an object by specifying a property path and value to set. Example: --set property1.property2=<value>
.
Property | Value |
---|---|
Parameter group: | Generic Update Arguments |
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Resource tags Support shorthand-syntax, json-file and yaml-file. Try "??" to show more.
Property | Value |
---|---|
Parameter group: | Parameters Arguments |
Global Parameters
Increase logging verbosity to show all debug logs.
Property | Value |
---|---|
Default value: | False |
Show this help message and exit.
Only show errors, suppressing warnings.
Property | Value |
---|---|
Default value: | False |
Output format.
Property | Value |
---|---|
Default value: | json |
Accepted values: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.
Property | Value |
---|---|
Default value: | False |
az image wait
Place the CLI in a waiting state until a condition is met.
az image wait [--created]
[--custom]
[--deleted]
[--exists]
[--expand]
[--ids]
[--image-name --name]
[--interval]
[--resource-group]
[--subscription]
[--timeout]
[--updated]
Optional Parameters
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
Wait until created with 'provisioningState' at 'Succeeded'.
Property | Value |
---|---|
Parameter group: | Wait Condition Arguments |
Default value: | False |
Wait until the condition satisfies a custom JMESPath query. E.g. provisioningState!='InProgress', instanceView.statuses[?code=='PowerState/running'].
Property | Value |
---|---|
Parameter group: | Wait Condition Arguments |
Wait until deleted.
Property | Value |
---|---|
Parameter group: | Wait Condition Arguments |
Default value: | False |
Wait until the resource exists.
Property | Value |
---|---|
Parameter group: | Wait Condition Arguments |
Default value: | False |
The expand expression to apply on the operation.
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.
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
The name of the image.
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Polling interval in seconds.
Property | Value |
---|---|
Parameter group: | Wait Condition Arguments |
Default value: | 30 |
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Maximum wait in seconds.
Property | Value |
---|---|
Parameter group: | Wait Condition Arguments |
Default value: | 3600 |
Wait until updated with provisioningState at 'Succeeded'.
Property | Value |
---|---|
Parameter group: | Wait Condition Arguments |
Default value: | False |
Global Parameters
Increase logging verbosity to show all debug logs.
Property | Value |
---|---|
Default value: | False |
Show this help message and exit.
Only show errors, suppressing warnings.
Property | Value |
---|---|
Default value: | False |
Output format.
Property | Value |
---|---|
Default value: | json |
Accepted values: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.
Property | Value |
---|---|
Default value: | False |