共用方式為


az group

管理資源群組和範本部署。

命令

名稱 Description 類型 狀態
az group create

建立新的資源群組。

Core GA
az group delete

刪除資源群組。

Core GA
az group exists

檢查資源群組是否存在。

Core GA
az group export

擷取資源群組作為範本。

Core GA
az group list

列出資源群組。

Core GA
az group lock

管理 Azure 資源群組鎖定。

Core GA
az group lock create

建立資源群組鎖定。

Core GA
az group lock delete

刪除資源群組鎖定。

Core GA
az group lock list

列出資源群組中的鎖定資訊。

Core GA
az group lock show

顯示資源群組鎖定的詳細數據。

Core GA
az group lock update

更新資源群組鎖定。

Core GA
az group show

取得資源群組。

Core GA
az group update

更新資源群組。

Core GA
az group wait

將 CLI 置於等候狀態,直到符合資源群組的條件為止。

Core GA

az group create

建立新的資源群組。

az group create --location
                --name --resource-group
                [--managed-by]
                [--tags]

範例

在美國西部區域建立新的資源群組。

az group create -l westus -n MyResourceGroup

必要參數

--location -l

Location. 值的來源:az account list-locations。 您可以使用 az configure --defaults location=<location>來設定預設位置。

--name --resource-group -g -n

新資源群組的名稱。

選擇性參數

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

--managed-by

管理此資源群組之資源的標識碼。

--tags

以空格分隔的標記:key[=value] [key[=value] ...]。使用 「清除現有的標記」。

全域參數
--debug

提高日誌詳細程度以顯示所有調試日誌。

屬性
預設值: False
--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

屬性
預設值: False
--output -o

Output format.

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

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

--subscription

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

--verbose

增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。

屬性
預設值: False

az group delete

刪除資源群組。

az group delete --name --resource-group
                [--force-deletion-types {Microsoft.Compute/virtualMachineScaleSets, Microsoft.Compute/virtualMachines, Microsoft.Databricks/workspaces}]
                [--no-wait]
                [--yes]

範例

刪除資源群組。

az group delete -n MyResourceGroup

強制刪除資源群組中的所有虛擬機。

az group delete -n MyResourceGroup --force-deletion-types Microsoft.Compute/virtualMachines

必要參數

--name --resource-group -g -n

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

選擇性參數

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

--force-deletion-types -f

您要強制刪除的資源類型。

屬性
接受的值: Microsoft.Compute/virtualMachineScaleSets, Microsoft.Compute/virtualMachines, Microsoft.Databricks/workspaces
--no-wait

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

屬性
預設值: False
--yes -y

請勿提示確認。

屬性
預設值: False
全域參數
--debug

提高日誌詳細程度以顯示所有調試日誌。

屬性
預設值: False
--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

屬性
預設值: False
--output -o

Output format.

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

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

--subscription

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

--verbose

增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。

屬性
預設值: False

az group exists

檢查資源群組是否存在。

az group exists --name --resource-group

範例

檢查 'MyResourceGroup' 是否存在。

az group exists -n MyResourceGroup

必要參數

--name --resource-group -g -n

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

全域參數
--debug

提高日誌詳細程度以顯示所有調試日誌。

屬性
預設值: False
--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

屬性
預設值: False
--output -o

Output format.

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

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

--subscription

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

--verbose

增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。

屬性
預設值: False

az group export

擷取資源群組作為範本。

az group export --name --resource-group
                [--include-comments]
                [--include-parameter-default-value]
                [--resource-ids]
                [--skip-all-params]
                [--skip-resource-name-params]

必要參數

--name --resource-group -g -n

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

選擇性參數

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

--include-comments

匯出具有批注的範本。

屬性
預設值: False
--include-parameter-default-value

匯出具有預設值的範本參數。

屬性
預設值: False
--resource-ids

要篩選匯出依據的空間分隔資源標識碼。 若要匯出所有資源,請勿指定此自變數或提供 “*”。

--skip-all-params

匯出範本參數並略過所有參數化。

屬性
預設值: False
--skip-resource-name-params

匯出範本並略過資源名稱參數化。

屬性
預設值: False
全域參數
--debug

提高日誌詳細程度以顯示所有調試日誌。

屬性
預設值: False
--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

屬性
預設值: False
--output -o

Output format.

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

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

--subscription

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

--verbose

增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。

屬性
預設值: False

az group list

列出資源群組。

az group list [--tag]

範例

列出位於美國西部區域的所有資源群組。

az group list --query "[?location=='westus']"

選擇性參數

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

--tag

'key[=value]' 格式的單一標記。 使用 「清除現有的標記」。

全域參數
--debug

提高日誌詳細程度以顯示所有調試日誌。

屬性
預設值: False
--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

屬性
預設值: False
--output -o

Output format.

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

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

--subscription

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

--verbose

增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。

屬性
預設值: False

az group show

取得資源群組。

az group show --name --resource-group

必要參數

--name --resource-group -g -n

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

全域參數
--debug

提高日誌詳細程度以顯示所有調試日誌。

屬性
預設值: False
--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

屬性
預設值: False
--output -o

Output format.

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

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

--subscription

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

--verbose

增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。

屬性
預設值: False

az group update

更新資源群組。

az group update --name --resource-group
                [--force-string]
                [--set]
                [--tags]

範例

更新資源群組。 (autogenerated)

az group update --resource-group MyResourceGroup --set tags.CostCenter='{"Dept":"IT","Environment":"Test"}'

必要參數

--name --resource-group -g -n

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

選擇性參數

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

--force-string

使用 'set' 或 'add' 時,請保留字串常值,而不是嘗試轉換成 JSON。

屬性
Parameter group: Generic Update Arguments
預設值: False
--set

指定要設定的屬性路徑和值,以更新物件。 範例: --set property1.property2=<value>.

屬性
Parameter group: Generic Update Arguments
預設值: []
--tags

以空格分隔的標記:key[=value] [key[=value] ...]。使用 「清除現有的標記」。

全域參數
--debug

提高日誌詳細程度以顯示所有調試日誌。

屬性
預設值: False
--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

屬性
預設值: False
--output -o

Output format.

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

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

--subscription

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

--verbose

增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。

屬性
預設值: False

az group wait

將 CLI 置於等候狀態,直到符合資源群組的條件為止。

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

範例

將 CLI 置於等候狀態,直到符合資源群組的條件為止。 (autogenerated)

az group wait --created  --resource-group MyResourceGroup

將 CLI 置於等候狀態,直到符合資源群組的條件為止。 (autogenerated)

az group wait --deleted --resource-group MyResourceGroup

必要參數

--name --resource-group -g -n

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

選擇性參數

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

--created

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

屬性
Parameter group: Wait Condition Arguments
預設值: False
--custom

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

屬性
Parameter group: Wait Condition Arguments
--deleted

等到刪除為止。

屬性
Parameter group: Wait Condition Arguments
預設值: False
--exists

等候資源存在。

屬性
Parameter group: Wait Condition Arguments
預設值: False
--interval

輪詢間隔以秒為單位。

屬性
Parameter group: Wait Condition Arguments
預設值: 30
--timeout

以秒為單位的等候上限。

屬性
Parameter group: Wait Condition Arguments
預設值: 3600
--updated

等到 provisioningState 更新為 'Succeeded'。

屬性
Parameter group: Wait Condition Arguments
預設值: False
全域參數
--debug

提高日誌詳細程度以顯示所有調試日誌。

屬性
預設值: False
--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

屬性
預設值: False
--output -o

Output format.

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

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

--subscription

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

--verbose

增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。

屬性
預設值: False