az deployment group

管理資源群組的 Azure Resource Manager 範本部署。

命令

名稱 Description 類型 狀態
az deployment group cancel

取消資源群組的部署。

核心 GA
az deployment group create

在資源群組啟動部署。

核心 GA
az deployment group delete

刪除資源群組的部署。

核心 GA
az deployment group export

匯出用於某個部署的範本。

核心 GA
az deployment group list

列出資源群組中的部署。

核心 GA
az deployment group show

顯示資源群組的部署。

核心 GA
az deployment group validate

驗證範本是否在資源群組中有效。

核心 GA
az deployment group wait

將 CLI 置於等候狀態,直到符合部署條件為止。

核心 GA
az deployment group what-if

在資源群組範圍執行部署 What-If 作業。

核心 GA

az deployment group cancel

取消資源群組的部署。

az deployment group cancel --name
                           --resource-group

範例

取消資源群組的部署。

az deployment group cancel -g testrg -n deployment01

必要參數

--name -n

部署名稱。

--resource-group -g

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

全域參數
--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 deployment group create

在資源群組啟動部署。

請只指定 --template-file FILE 的其中一個 |--template-uri URI |--template-spec 以輸入 ARM 範本。

az deployment group create --resource-group
                           [--aux-subs]
                           [--aux-tenants]
                           [--confirm-with-what-if]
                           [--handle-extended-json-format]
                           [--mode {Complete, Incremental}]
                           [--name]
                           [--no-prompt {false, true}]
                           [--no-wait]
                           [--parameters]
                           [--proceed-if-no-change]
                           [--query-string]
                           [--rollback-on-error]
                           [--template-file]
                           [--template-spec]
                           [--template-uri]
                           [--what-if]
                           [--what-if-exclude-change-types {Create, Delete, Deploy, Ignore, Modify, NoChange, Unsupported}]
                           [--what-if-result-format {FullResourcePayloads, ResourceIdOnly}]

範例

使用本機 JSON 檔案中的參數,從遠端範本檔案在資源群組建立部署。

az deployment group create --resource-group testrg --name rollout01 \
    --template-uri https://myresource/azuredeploy.json --parameters @myparameters.json

使用 JSON 字串中的參數,從本機範本檔案在資源群組建立部署。

az deployment group create --resource-group testrg --name rollout01 \
    --template-file azuredeploy.json  \
    --parameters '{ \"policyName\": { \"value\": \"policy2\" } }'

使用陣列字串中的參數,從本機範本檔案在資源群組建立部署。

az deployment group create --resource-group testgroup --template-file demotemplate.json --parameters exampleString='inline string' exampleArray='("value1", "value2")'

使用參數檔案、遠端參數檔案,以及選擇性地覆寫索引鍵/值組,從本機範本建立資源群組的部署。

az deployment group create --resource-group testrg --name rollout01 \
    --template-file azuredeploy.json  --parameters @params.json \
    --parameters https://mysite/params.json --parameters MyValue=This MyArray=@array.json

從範本規格在資源群組範圍建立部署

az deployment group create --resource-group testrg --template-spec "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testrg/providers/Microsoft.Resources/templateSpecs/myTemplateSpec/versions/1.0"

從 bicepparam 參數檔案在資源群組範圍建立部署

az deployment group create --resource-group testrg --parameters parameters.bicepparam

在跨租使用者的資源群組建立部署

az deployment group create --resource-group testrg --name rollout01 \
    --template-file azuredeploy.json --parameters @myparameters.json --aux-tenants auxiliary_tenant01 auxiliary_tenant02

必要參數

--resource-group -g

要建立部署的資源群組。

選擇性參數

--aux-subs
已被取代

選項 '--aux-subs' 已被取代,並將在未來版本中移除。 請改用 '--aux-tenants'。

將在跨租使用者部署期間使用的輔助訂用帳戶。

--aux-tenants

將在跨租使用者部署期間使用的輔助租使用者。

--confirm-with-what-if -c

指示命令在執行部署之前執行部署 What-If。 然後,它會提示您確認資源變更,然後再繼續。

--handle-extended-json-format -j
已被取代

選項 '--handle-extended-json-format/-j' 已被取代,並將在未來版本中移除。

支援處理擴充範本內容,包括部署中的多行和批註。

--mode

部署模式。

接受的值: Complete, Incremental
預設值: Incremental
--name -n

部署名稱。

--no-prompt

停用 ARM 範本遺漏參數提示的選項。 當值為 true 時,將會忽略要求使用者提供遺漏參數的提示。 預設值為 false。

接受的值: false, true
預設值: False
--no-wait

請勿等候長時間執行的作業完成。

預設值: False
--parameters -p

提供部署參數值。

您可以使用語法、JSON 字串或 < KEY=VALUE > 組,從檔案 @{path} 提供參數。 參數會依序評估,因此當指派值兩次時,將會使用後者的值。 建議您先提供參數檔案,然後使用 KEY=VALUE 語法選擇性地覆寫。 另請注意,如果您要提供 bicepparam 檔案,則您只能使用此引數一次。

--proceed-if-no-change

如果 What-If 結果不包含任何資源變更,請指示命令執行部署。 適用于設定 --confirm-with-what-if 時。

--query-string -q

在連結範本的情況下,要與 template-uri 搭配使用的查詢字串(SAS 權杖)。

--rollback-on-error

要在錯誤時復原至的部署名稱,或使用 做為旗標來回複至最後一次成功的部署。

--template-file -f

範本檔案或 Bicep 檔案的路徑。

--template-spec -s

範本規格資源識別碼。

--template-uri -u

範本檔案的 URI。

--what-if -w

指示命令執行部署 What-If。

--what-if-exclude-change-types -x

要從 What-If 結果中排除的資源變更類型空格分隔清單。 適用于設定 --confirm-with-what-if 時。

接受的值: Create, Delete, Deploy, Ignore, Modify, NoChange, Unsupported
--what-if-result-format -r

What-If 結果的格式。 設定時 --confirm-with-what-if 適用。

接受的值: FullResourcePayloads, ResourceIdOnly
預設值: FullResourcePayloads
全域參數
--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 deployment group delete

刪除資源群組的部署。

az deployment group delete --name
                           --resource-group
                           [--no-wait]

範例

刪除資源群組的部署。

az deployment group delete -g testrg -n deployment01

必要參數

--name -n

部署名稱。

--resource-group -g

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

選擇性參數

--no-wait

請勿等候長時間執行的作業完成。

預設值: False
全域參數
--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 deployment group export

匯出用於某個部署的範本。

az deployment group export --name
                           --resource-group

範例

匯出用於資源群組部署的範本。

az deployment group export --resource-group testrg --name MyDeployment

必要參數

--name -n

部署名稱。

--resource-group -g

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

全域參數
--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 deployment group list

列出資源群組中的部署。

az deployment group list --resource-group
                         [--filter]

範例

列出資源群組中的部署。

az deployment group list -g testrg

必要參數

--resource-group -g

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

選擇性參數

--filter
預覽

使用 OData 標記法篩選運算式。 您可以使用 --filter 「provisioningState eq '{state}'」 來篩選 provisioningState。 若要取得詳細資訊,請造訪 https://docs.microsoft.com/rest/api/resources/deployments/listatsubscriptionscope#uri-parameters

全域參數
--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 deployment group show

顯示資源群組的部署。

az deployment group show --name
                         --resource-group

範例

顯示資源群組的部署。

az deployment group show -g testrg -n deployment01

必要參數

--name -n

部署名稱。

--resource-group -g

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

全域參數
--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 deployment group validate

驗證範本是否在資源群組中有效。

請只指定 --template-file FILE 的其中一個 |--template-uri URI |--template-spec 以輸入 ARM 範本。

az deployment group validate --resource-group
                             [--handle-extended-json-format]
                             [--mode {Complete, Incremental}]
                             [--name]
                             [--no-prompt {false, true}]
                             [--parameters]
                             [--query-string]
                             [--rollback-on-error]
                             [--template-file]
                             [--template-spec]
                             [--template-uri]

範例

驗證範本是否在資源群組中有效。

az deployment group validate --resource-group testrg --template-file {template-file}

驗證範本是否在資源群組中有效。 (自動產生)

az deployment group validate --parameters MyValue=This MyArray=@array.json --resource-group testrg --template-file azuredeploy.json

必要參數

--resource-group -g

要建立部署的資源群組。

選擇性參數

--handle-extended-json-format -j
已被取代

選項 '--handle-extended-json-format/-j' 已被取代,並將在未來版本中移除。

支援處理擴充範本內容,包括部署中的多行和批註。

--mode

部署模式。

接受的值: Complete, Incremental
預設值: Incremental
--name -n

部署名稱。

--no-prompt

停用 ARM 範本遺漏參數提示的選項。 當值為 true 時,將會忽略要求使用者提供遺漏參數的提示。 預設值為 false。

接受的值: false, true
預設值: False
--parameters -p

提供部署參數值。

您可以使用語法、JSON 字串或 < KEY=VALUE > 組,從檔案 @{path} 提供參數。 參數會依序評估,因此當指派值兩次時,將會使用後者的值。 建議您先提供參數檔案,然後使用 KEY=VALUE 語法選擇性地覆寫。

--query-string -q

在連結範本的情況下,要與 template-uri 搭配使用的查詢字串(SAS 權杖)。

--rollback-on-error

要在錯誤時復原至的部署名稱,或使用 做為旗標來回複至最後一次成功的部署。

--template-file -f

範本檔案或 Bicep 檔案的路徑。

--template-spec -s

範本規格資源識別碼。

--template-uri -u

範本檔案的 URI。

全域參數
--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 deployment group wait

將 CLI 置於等候狀態,直到符合部署條件為止。

az deployment group wait --name
                         --resource-group
                         [--created]
                         [--custom]
                         [--deleted]
                         [--exists]
                         [--interval]
                         [--timeout]
                         [--updated]

範例

將 CLI 置於等候狀態,直到符合部署條件為止。 (自動產生)

az deployment group wait --created --name MyDeployment --resource-group MyResourceGroup

必要參數

--name -n

部署名稱。

--resource-group -g

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

選擇性參數

--created

請等候在 'Succeeded' 使用 'provisioningState' 建立。

預設值: False
--custom

等到條件符合自訂 JMESPath 查詢為止。 例如 provisioningState!='InProgress', instanceView.statuses[?code=='PowerState/running']。

--deleted

等到刪除為止。

預設值: False
--exists

等候資源存在。

預設值: False
--interval

輪詢間隔以秒為單位。

預設值: 30
--timeout

以秒為單位的等候上限。

預設值: 3600
--updated

等到 provisioningState 更新為 'Succeeded'。

預設值: False
全域參數
--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 deployment group what-if

在資源群組範圍執行部署 What-If 作業。

請只指定 --template-file FILE 的其中一個 |--template-uri URI |--template-spec 以輸入 ARM 範本。

az deployment group what-if --resource-group
                            [--aux-tenants]
                            [--exclude-change-types {Create, Delete, Deploy, Ignore, Modify, NoChange, Unsupported}]
                            [--mode {Complete, Incremental}]
                            [--name]
                            [--no-pretty-print]
                            [--no-prompt {false, true}]
                            [--parameters]
                            [--query-string]
                            [--result-format {FullResourcePayloads, ResourceIdOnly}]
                            [--template-file]
                            [--template-spec]
                            [--template-uri]

範例

在資源群組上執行部署 What-If 作業。

az deployment group what-if --resource-group testrg --name rollout01 --template-uri https://myresource/azuredeploy.json --parameters @myparameters.json

以 ResourceIdOnly 格式在資源群組上執行部署 What-If 作業。

az deployment group what-if --resource-group testrg --name rollout01 --template-uri https://myresource/azuredeploy.json --parameters @myparameters.json --result-format ResourceIdOnly

在資源群組上執行部署 What-If 作業,而不需列印結果。

az deployment group what-if --resource-group testrg --name rollout01 --template-uri https://myresource/azuredeploy.json --parameters @myparameters.json --no-pretty-print

必要參數

--resource-group -g

要執行部署 What-If 作業的資源群組。

選擇性參數

--aux-tenants

將在跨租使用者部署期間使用的輔助租使用者。

--exclude-change-types -x

要從 What-If 結果中排除的資源變更類型空格分隔清單。

接受的值: Create, Delete, Deploy, Ignore, Modify, NoChange, Unsupported
--mode

部署模式。

接受的值: Complete, Incremental
預設值: Incremental
--name -n

部署名稱。

--no-pretty-print

停用 What-If 結果的美化列印。 設定時,將會使用輸出格式類型。

--no-prompt

停用 ARM 範本遺漏參數提示的選項。 當值為 true 時,將會忽略要求使用者提供遺漏參數的提示。 預設值為 false。

接受的值: false, true
預設值: False
--parameters -p

提供部署參數值。

您可以使用語法、JSON 字串或 < KEY=VALUE > 組,從檔案 @{path} 提供參數。 參數會依序評估,因此當指派值兩次時,將會使用後者的值。 建議您先提供參數檔案,然後使用 KEY=VALUE 語法選擇性地覆寫。

--query-string -q

在連結範本的情況下,要與 template-uri 搭配使用的查詢字串(SAS 權杖)。

--result-format -r

What-If 結果的格式。

接受的值: FullResourcePayloads, ResourceIdOnly
預設值: FullResourcePayloads
--template-file -f

範本檔案或 Bicep 檔案的路徑。

--template-spec -s

範本規格資源識別碼。

--template-uri -u

範本檔案的 URI。

全域參數
--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 來取得完整偵錯記錄。