共用方式為


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。