az group

az group

Manage resource groups and template deployments.

In this article

Commands

az group create

Edit

Create a new resource group.

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

Examples

Create a new resource group in the West US region.

az group create -l westus -n MyResourceGroup

Required Parameters

–location -l

Location. Values from: az account list-locations. You can configure the default location using az configure --defaults location=<location>.

–name –resource-group -g -n

Name of the new resource group.

Optional Parameters

–managed-by

The ID of the resource that manages this resource group.

–tags

Space-separated tags: key[=value] [key[=value] …]. Use “” to clear existing tags.

Global Parameters

–debug

Increase logging verbosity to show all debug logs.

–help -h

Show this help message and exit.

–only-show-errors

Only show errors, suppressing warnings.

–output -o

Output format.

–query

JMESPath query string. See http://jmespath.org/ for more information and examples.

–subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

–verbose

Increase logging verbosity. Use –debug for full debug logs.

az group delete

Edit

Delete a resource group.

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

Examples

Delete a resource group.

az group delete -n MyResourceGroup

Force delete all the Virtual Machines in a resource group.

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

Required Parameters

–name –resource-group -g -n

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Optional Parameters

–force-deletion-types -f

The resource types you want to force delete.

accepted values:

Microsoft.Compute/virtualMachineScaleSets, Microsoft.Compute/virtualMachines

–no-wait

Do not wait for the long-running operation to finish.

default value:

False

–yes -y

Do not prompt for confirmation.

default value:

False
Global Parameters

–debug

Increase logging verbosity to show all debug logs.

–help -h

Show this help message and exit.

–only-show-errors

Only show errors, suppressing warnings.

–output -o

Output format.

–query

JMESPath query string. See http://jmespath.org/ for more information and examples.

–subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

–verbose

Increase logging verbosity. Use –debug for full debug logs.

az group exists

Edit

Check if a resource group exists.

az group exists --name

Examples

Check if ‘MyResourceGroup’ exists.

az group exists -n MyResourceGroup

Required Parameters

–name –resource-group -g -n

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Global Parameters

–debug

Increase logging verbosity to show all debug logs.

–help -h

Show this help message and exit.

–only-show-errors

Only show errors, suppressing warnings.

–output -o

Output format.

–query

JMESPath query string. See http://jmespath.org/ for more information and examples.

–subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

–verbose

Increase logging verbosity. Use –debug for full debug logs.

az group export

Edit

Captures a resource group as a template.

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

Required Parameters

–name –resource-group -g -n

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Optional Parameters

–include-comments

Export template with comments.

default value:

False

–include-parameter-default-value

Export template parameter with default value.

default value:

False

–resource-ids

Space-separated resource ids to filter the export by. To export all resources, do not specify this argument or supply “*”.

–skip-all-params

Export template parameter and skip all parameterization.

default value:

False

–skip-resource-name-params

Export template and skip resource name parameterization.

default value:

False
Global Parameters

–debug

Increase logging verbosity to show all debug logs.

–help -h

Show this help message and exit.

–only-show-errors

Only show errors, suppressing warnings.

–output -o

Output format.

–query

JMESPath query string. See http://jmespath.org/ for more information and examples.

–subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

–verbose

Increase logging verbosity. Use –debug for full debug logs.

az group list

Edit

List resource groups.

az group list [--tag]

Examples

List all resource groups located in the West US region.

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

Optional Parameters

–tag

A single tag in ‘key[=value]’ format. Use “” to clear existing tags.

Global Parameters

–debug

Increase logging verbosity to show all debug logs.

–help -h

Show this help message and exit.

–only-show-errors

Only show errors, suppressing warnings.

–output -o

Output format.

–query

JMESPath query string. See http://jmespath.org/ for more information and examples.

–subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

–verbose

Increase logging verbosity. Use –debug for full debug logs.

az group show

Edit

Gets a resource group.

az group show --name

Required Parameters

–name –resource-group -g -n

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Global Parameters

–debug

Increase logging verbosity to show all debug logs.

–help -h

Show this help message and exit.

–only-show-errors

Only show errors, suppressing warnings.

–output -o

Output format.

–query

JMESPath query string. See http://jmespath.org/ for more information and examples.

–subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

–verbose

Increase logging verbosity. Use –debug for full debug logs.

Update a resource group.

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

Update a resource group. (autogenerated)

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

–name –resource-group -g -n

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

–force-string

When using ‘set’ or ‘add’, preserve string literals instead of attempting to convert to JSON.

default value:

False

–set

Update an object by specifying a property path and value to set. Example: –set property1.property2=.

default value:

[]

–tags

Space-separated tags: key[=value] [key[=value] …]. Use “” to clear existing tags.

Global Parameters

–debug

Increase logging verbosity to show all debug logs.

–help -h

Show this help message and exit.

–only-show-errors

Only show errors, suppressing warnings.

–output -o

Output format.

–query

JMESPath query string. See http://jmespath.org/ for more information and examples.

–subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

–verbose

Increase logging verbosity. Use –debug for full debug logs.

az group wait

Edit

Place the CLI in a waiting state until a condition of the resource group is met.

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

Examples

Place the CLI in a waiting state until a condition of the resource group is met. (autogenerated)

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

Place the CLI in a waiting state until a condition of the resource group is met. (autogenerated)

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

Required Parameters

–name –resource-group -g -n

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Optional Parameters

–created

Wait until created with ‘provisioningState’ at ‘Succeeded’.

default value:

False

–custom

Wait until the condition satisfies a custom JMESPath query. E.g. provisioningState!=’InProgress’, instanceView.statuses[?code==’PowerState/running’].

–deleted

Wait until deleted.

default value:

False

–exists

Wait until the resource exists.

default value:

False

–interval

Polling interval in seconds.

default value:

30

–timeout

Maximum wait in seconds.

default value:

3600

–updated

Wait until updated with provisioningState at ‘Succeeded’.

default value:

False
Global Parameters

–debug

Increase logging verbosity to show all debug logs.

–help -h

Show this help message and exit.

–only-show-errors

Only show errors, suppressing warnings.

–output -o

Output format.

–query

JMESPath query string. See http://jmespath.org/ for more information and examples.

–subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

–verbose

Increase logging verbosity. Use –debug for full debug logs.

Alternate Text Gọi ngay