Share via


az image builder customizer

Manage image builder template customizers.

Commands

Name Description Type Status
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 customizer add

Add an image builder customizer to an image builder template.

Must be used with --defer.

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

Examples

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

az image builder customizer add -n myTemplate -g myGroup \
    --inline-script "sudo mkdir /buildArtifacts" \
                    "sudo cp /tmp/index.html /buildArtifacts/index.html" \
    --customizer-name shellScriptInline --type shell --defer

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

az image builder customizer add -n myTemplate -g myGroup \
    --customizer-name myFile --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 builder customizer add -n myTemplate -g myGroup \
--customizer-name shellScriptUrl \
--restart-check-command "echo Azure-Image-Builder-Restarted-the-VM  > \
                        c:\buildArtifacts\restart.txt" \
    --type windows-restart --restart-timeout 10m --defer

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

az image builder customizer add -n myTemplate -g myGroup --customizer-name winUpdate --type windows-update --search-criteria IsInstalled=0 --filters "exclude:\$_.Title -like \'*Preview*\'" "include:\$true" --update-limit 20 --defer

Required Parameters

--customizer-name

Name of the customizer.

--type -t

Type of customizer to be added to the image template.

Property Value
Accepted values: file, powershell, shell, windows-restart, windows-update

Optional Parameters

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

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

Property Value
Parameter group: File Arguments
--exit-codes -e

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

Property Value
Parameter group: Powershell Arguments
--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.

Property Value
Parameter group: File Arguments
--filters

Space delimited filters to select updates to apply. Omit or specify empty array to use the default (no filter).

Property Value
Parameter group: Windows Update Arguments
--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.

Property Value
Parameter group: Resource Id Arguments
--inline-script

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

Property Value
Parameter group: Shell and Powershell Arguments
--name -n

The name of the image template.

Property Value
Parameter group: Resource Id Arguments
--resource-group -g

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

Property Value
Parameter group: Resource Id Arguments
--restart-check-command

Command to verify that restart succeeded.

Property Value
Parameter group: Windows Restart Arguments
--restart-command

Command to execute the restart operation.

Property Value
Parameter group: Windows Restart Arguments
--restart-timeout

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

Property Value
Parameter group: Windows Restart Arguments
Default value: 5m
--script-url

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

Property Value
Parameter group: Shell and Powershell Arguments
--search-criteria

Criteria to search updates. Omit or specify empty string to use the default (search all). Refer to above link for examples and detailed description of this field.

Property Value
Parameter group: Windows Update Arguments
--subscription

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
--update-limit

Maximum number of updates to apply at a time. Omit or specify 0 to use the default (1000).

Property Value
Parameter group: Windows Update Arguments
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

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

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

--verbose

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

Property Value
Default value: False

az image builder customizer clear

Remove all image builder customizers from an image builder template.

Must be used with --defer.

az image builder customizer clear [--defer]
                                  [--ids]
                                  [--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.

--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). 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
--name -n

The name of the image template.

Property Value
Parameter group: Resource Id Arguments
--resource-group -g

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

Property Value
Parameter group: Resource Id Arguments
--subscription

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

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

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

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

--verbose

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

Property Value
Default value: False

az image builder customizer remove

Remove an image builder customizer from an image builder template.

Must be used with --defer.

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

Required Parameters

--customizer-name

Name of the customizer.

Optional Parameters

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--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). 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
--name -n

The name of the image template.

Property Value
Parameter group: Resource Id Arguments
--resource-group -g

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

Property Value
Parameter group: Resource Id Arguments
--subscription

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

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

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

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

--verbose

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

Property Value
Default value: False