共用方式為


az deployment mg

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

命令

名稱 Description 類型 狀態
az deployment mg cancel

取消管理群組的部署。

核心 加語
az deployment mg create

在管理群組啟動部署。

核心 加語
az deployment mg delete

刪除管理群組的部署。

核心 加語
az deployment mg export

匯出用於部署的範本。

核心 加語
az deployment mg list

列出管理群組中的部署。

核心 加語
az deployment mg show

顯示管理群組的部署。

核心 加語
az deployment mg validate

驗證範本是否在管理群組中有效。

核心 加語
az deployment mg wait

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

核心 加語
az deployment mg what-if

在管理群組範圍執行部署 What-If 作業。

核心 加語

az deployment mg cancel

取消管理群組的部署。

az deployment mg cancel --management-group-id
                        --name

範例

取消管理群組的部署。

az deployment mg cancel -m testmg -n deployment01

必要參數

--management-group-id -m

管理群組標識碼。

--name -n

部署名稱。

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

在管理群組啟動部署。

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

az deployment mg create --location
                        --management-group-id
                        [--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]
                        [--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 mg create --management-group-id testrg --name rollout01 --location WestUS \
    --template-uri https://myresource/azuredeploy.json --parameters @myparameters.json

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

az deployment mg create --management-group-id testmg --name rollout01 --location WestUS \
    --template-file azuredeploy.json \
    --parameters '{ \"policyName\": { \"value\": \"policy2\" } }'

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

az deployment mg create --management-group-id testmg --name rollout01 --location WestUS \
    --template-file azuredeploy.json --parameters @params.json \
    --parameters https://mysite/params.json --parameters MyValue=This MyArray=@array.json

必要參數

--location -l

要儲存部署元數據的位置。

--management-group-id -m

要建立部署的管理群組標識碼。

選擇性參數

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

提供部署參數值。

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

--proceed-if-no-change

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

--query-string -q

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

--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 mg delete

刪除管理群組的部署。

az deployment mg delete --management-group-id
                        --name
                        [--no-wait]

範例

刪除管理群組的部署。

az deployment mg delete -m testmg -n deployment01

必要參數

--management-group-id -m

管理群組標識碼。

--name -n

部署名稱。

選擇性參數

--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 mg export

匯出用於部署的範本。

az deployment mg export --management-group-id
                        --name

範例

匯出用於管理群組部署的範本。

az deployment mg export --management-group-id testmg --name MyDeployment

必要參數

--management-group-id -m

管理群組標識碼。

--name -n

部署名稱。

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

列出管理群組中的部署。

az deployment mg list --management-group-id
                      [--filter]

範例

列出管理群組中的部署。

az deployment mg list -m testmg

必要參數

--management-group-id -m

管理群組標識碼。

選擇性參數

--filter
預覽

使用 OData 表示法篩選表達式。 您可以使用 --filter “provisioningState eq '{state}'” 來篩選 provisioningState。 若要取得詳細資訊,請造訪 https://learn.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 mg show

顯示管理群組的部署。

az deployment mg show --management-group-id
                      --name

範例

顯示管理群組的部署。

az deployment mg show -m testmg -n deployment01

必要參數

--management-group-id -m

管理群組標識碼。

--name -n

部署名稱。

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

驗證範本是否在管理群組中有效。

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

az deployment mg validate --location
                          --management-group-id
                          [--handle-extended-json-format]
                          [--name]
                          [--no-prompt {false, true}]
                          [--parameters]
                          [--query-string]
                          [--template-file]
                          [--template-spec]
                          [--template-uri]

範例

驗證範本是否在管理群組中有效。

az deployment mg validate --management-group-id testmg --location WestUS --template-file {template-file}

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

az deployment mg validate --location WestUS --management-group-id testmg --name mydeployment --parameters @myparameters.json --template-file azuredeploy.json

必要參數

--location -l

要儲存部署元數據的位置。

--management-group-id -m

要建立部署的管理群組標識碼。

選擇性參數

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

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

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

--name -n

部署名稱。

--no-prompt

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

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

提供部署參數值。

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

--query-string -q

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

--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 mg wait

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

az deployment mg wait --management-group-id
                      --name
                      [--created]
                      [--custom]
                      [--deleted]
                      [--exists]
                      [--interval]
                      [--timeout]
                      [--updated]

必要參數

--management-group-id -m

管理群組標識碼。

--name -n

部署名稱。

選擇性參數

--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 mg what-if

在管理群組範圍執行部署 What-If 作業。

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

az deployment mg what-if --location
                         --management-group-id
                         [--exclude-change-types {Create, Delete, Deploy, Ignore, Modify, NoChange, Unsupported}]
                         [--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 mg what-if --management-group-id testmg --location westus --name rollout01 --template-uri https://myresource/azuredeploy.json --parameters @myparameters.json

使用 ResourceIdOnly 格式在管理群組上執行部署 What-If 作業。

az deployment mg what-if --management-group-id testmg --location westus --name rollout01 --template-uri https://myresource/azuredeploy.json --parameters @myparameters.json --result-format ResourceIdOnly

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

az deployment mg what-if --management-group-id testmg --location westus --name rollout01 --template-uri https://myresource/azuredeploy.json --parameters @myparameters.json --no-pretty-print

必要參數

--location -l

要儲存部署元數據的位置。

--management-group-id -m

要建立部署的管理群組標識碼。

選擇性參數

--exclude-change-types -x

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

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

部署名稱。

--no-pretty-print

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

--no-prompt

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

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

提供部署參數值。

參數可以使用 @{path} 語法、JSON 字串,或作為 <KEY=VALUE> 組,從檔案提供。 參數會依序評估,因此當指派值兩次時,將會使用後者的值。 建議您先提供參數檔案,然後使用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。