az image template customizer

Manage image builder template customizers.

Commands

az image template customizer add Add an image builder customizer to an image builder template.
az image template customizer clear Remove all image builder customizers from an image builder template.
az image template customizer remove Remove an image builder customizer from an image builder template.

az image template customizer add

Add an image builder customizer to an image builder template.

az image template customizer add --customizer-name
--type {file, powershell, shell, windows-restart}
[--defer]
[--dest-path]
[--exit-codes]
[--file-source]
[--ids]
[--inline-script]
[--name]
[--resource-group]
[--restart-check-command]
[--restart-command]
[--restart-timeout]
[--script-url]
[--subscription]

Examples

Add an inline shell customizer to an image template in the cli object cache

az image template customizer add -n mytemplate -g my-group \
    --inline-script "sudo mkdir /buildArtifacts" \
                    "sudo cp /tmp/index.html /buildArtifacts/index.html" \
    --customizer-name shell-script-inline --type shell --defer

Add a file customizer to an image template in the cli object cache

az image template customizer add -n mytemplate -g my-group \
    --customizer-name my-file --type file \
    --file-source "https://my-remote-file.html" --dest-path "/tmp/index.html" --defer

Add a windows restart customizer to an image template in the cli object cache

az image template customizer add -n mytemplate -g my-group \
--customizer-name shell-script-url \
--restart-check-command "echo Azure-Image-Builder-Restarted-the-VM  > \
                        c:\buildArtifacts\restart.txt" \
    --type windows-restart --restart-timeout 10m --defer

Required Parameters

--customizer-name

Name of the customizer.

--type -t

Type of customizer to be added to the image template.

accepted values: file, powershell, shell, windows-restart

Optional Parameters

--defer

Temporarily store the object in the local cache instead of sending to Azure. Use az cache commands to view/clear.

--dest-path

The absolute destination path where the file specified in --file-source will be downloaded to in the image.

--exit-codes -e

Space-separated list of valid exit codes, as integers.

--file-source

The URI of the file to be downloaded into the image. It can be a github link, SAS URI for Azure Storage, etc.

--ids

One or more resource IDs (space-delimited). If provided, no other 'Resource Id' arguments should be specified.

--inline-script

Space-separated list of inline script lines to customize the image with.

--name -n

The name of the image template.

--resource-group -g

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

--restart-check-command

Command to verify that restart succeeded.

--restart-command

Command to execute the restart operation.

--restart-timeout

Restart timeout specified as a string consisting of a magnitude and unit, e.g. '5m' (5 minutes) or '2h' (2 hours).

default value: 5m
--script-url

URL of script to customize the image with. The URL must be publicly accessible.

--subscription

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

az image template customizer clear

Remove all image builder customizers from an image builder template.

az image template customizer clear [--defer]
[--ids]
[--name]
[--resource-group]
[--subscription]

Optional Parameters

--defer

Temporarily store the object in the local cache instead of sending to Azure. Use az cache commands to view/clear.

--ids

One or more resource IDs (space-delimited). If provided, no other 'Resource Id' arguments should be specified.

--name -n

The name of the image template.

--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 template customizer remove

Remove an image builder customizer from an image builder template.

az image template customizer remove --customizer-name
[--defer]
[--ids]
[--name]
[--resource-group]
[--subscription]

Required Parameters

--customizer-name

Name of the customizer.

Optional Parameters

--defer

Temporarily store the object in the local cache instead of sending to Azure. Use az cache commands to view/clear.

--ids

One or more resource IDs (space-delimited). If provided, no other 'Resource Id' arguments should be specified.

--name -n

The name of the image template.

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