az image builder customizer

管理映射產生器範本自訂工具。

命令

名稱 Description 類型 狀態
az image builder customizer add

將影像產生器自訂工具新增至映射產生器範本。

核心 GA
az image builder customizer clear

從映射產生器範本中移除所有映射產生器自訂工具。

核心 GA
az image builder customizer remove

從映射產生器範本中移除映射產生器自訂工具。

核心 GA

az image builder customizer add

將影像產生器自訂工具新增至映射產生器範本。

必須與 --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]

範例

將內嵌殼層自訂工具新增至 cli 物件快取中的映射範本

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

將檔案自訂工具新增至 cli 物件快取中的映射範本

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

將 Windows 重新開機自訂工具新增至 cli 物件快取中的映射範本

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

將 Windows Update 自訂工具新增至 cli 物件快取中的映射範本。

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

必要參數

--customizer-name

自訂工具的名稱。

--type -t

要新增至映射範本的自訂工具類型。

接受的值: file, powershell, shell, windows-restart, windows-update

選擇性參數

--defer

暫時將物件儲存在本機快取中,而不是傳送至 Azure。 使用 az cache 命令來檢視/清除。

--dest-path

--file-source 中指定的檔案將會下載到映射中的絕對目的地路徑。

--exit-codes -e

有效結束代碼的空間分隔清單,以整數表示。

--file-source

要下載至映射之檔案的 URI。 它可以是 github 連結、Azure 儲存體的 SAS URI 等等。

--filters

要選取要套用更新的空間分隔篩選準則。 省略或指定空陣列以使用預設值 (沒有篩選準則)。

--ids

一或多個資源識別碼 (以空格分隔)。 它應該是包含 「資源識別碼」引數所有資訊的完整資源識別碼。 您應該提供 --ids 或其他「資源識別碼」引數。

--inline-script

以空格分隔的內嵌腳本行清單,以自訂影像。

--name -n

映射範本的名稱。

--resource-group -g

資源組名。 您可以使用 來設定預設群組 az configure --defaults group=<name>

--restart-check-command

確認重新開機成功的命令。

--restart-command

執行重新開機作業的命令。

--restart-timeout

指定為字串的重新開機逾時,包括大小和單位,例如 '5m' (5 分鐘) 或 '2h' (2 小時)。

預設值: 5m
--script-url

用來自訂影像的腳本 URL。 URL 必須可公開存取。

--search-criteria

搜尋更新的準則。 省略或指定空字串以使用預設值(全部搜尋)。 如需此欄位的範例和詳細描述,請參閱上述連結。

--subscription

訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID 帳戶。

--update-limit

一次要套用的更新數目上限。 省略或指定 0 以使用預設值 (1000)。

全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID 帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。

az image builder customizer clear

從映射產生器範本中移除所有映射產生器自訂工具。

必須與 --defer 搭配使用。

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

選擇性參數

--defer

暫時將物件儲存在本機快取中,而不是傳送至 Azure。 使用 az cache 命令來檢視/清除。

--ids

一或多個資源識別碼 (以空格分隔)。 它應該是包含 「資源識別碼」引數所有資訊的完整資源識別碼。 您應該提供 --ids 或其他「資源識別碼」引數。

--name -n

映射範本的名稱。

--resource-group -g

資源組名。 您可以使用 來設定預設群組 az configure --defaults group=<name>

--subscription

訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID 帳戶。

全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID 帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。

az image builder customizer remove

從映射產生器範本中移除映射產生器自訂工具。

必須與 --defer 搭配使用。

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

必要參數

--customizer-name

自訂工具的名稱。

選擇性參數

--defer

暫時將物件儲存在本機快取中,而不是傳送至 Azure。 使用 az cache 命令來檢視/清除。

--ids

一或多個資源識別碼 (以空格分隔)。 它應該是包含 「資源識別碼」引數所有資訊的完整資源識別碼。 您應該提供 --ids 或其他「資源識別碼」引數。

--name -n

映射範本的名稱。

--resource-group -g

資源組名。 您可以使用 來設定預設群組 az configure --defaults group=<name>

--subscription

訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID 帳戶。

全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID 帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。