Resource groups - az group

Manage resource groups and template deployments.

Commands

az group create Create a new resource group.
az group delete Delete resource group.
az group deployment Manage Azure Resource Manager deployments.
az group deployment create Start a deployment.
az group deployment delete Deletes a deployment from the deployment history.
az group deployment export Export the template used for the specified deployment.
az group deployment list Get all the deployments for a resource group.
az group deployment operation Manage deployment operations.
az group deployment operation list Gets all deployments operations for a deployment.
az group deployment operation show Get a deployment's operation.
az group deployment show Gets a deployment.
az group deployment validate Validate whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.
az group deployment wait Place the CLI in a waiting state until a condition of the deployment is met.
az group exists Checks whether resource group exists.
az group export Captures a resource group as a template.
az group list List resource groups, optionally filtered by a tag.
az group show Gets a resource group.
az group update Update a resource group.
az group wait Place the CLI in a waiting state until a condition of the resource group is met.

az group create

Create a new resource group.

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

Examples

Create a resource group in West US.

az group create -l westus -n MyResourceGroup

Required Parameters

--location -l

Location. You can configure the default location using az configure --defaults location=.

--name -n

Name of the new resource group.

Optional Parameters

--tags

Space separated tags in 'key[=value]' format. Use "" to clear existing tags.

az group delete

Delete resource group.

az group delete --name
[--no-wait]
[--yes]

Examples

Delete a resource group.

az group delete -n MyResourceGroup

Required Parameters

--name -n

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

Optional Parameters

--no-wait

Do not wait for the long running operation to finish.

--yes -y

Do not prompt for confirmation.

az group exists

Checks whether resource group exists.

az group exists --name

Examples

Check group existence.

az group exists -n MyResourceGroup

Required Parameters

--name -n

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

az group export

Captures a resource group as a template.

az group export --name
[--include-comments]
[--include-parameter-default-value]

Required Parameters

--name -n

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

Optional Parameters

--include-comments

Export template with comments.

--include-parameter-default-value

Export template parameter with default value.

az group list

List resource groups, optionally filtered by a tag.

az group list [--tag]

Examples

List all resource groups for West US.

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

Optional Parameters

--tag

A single tag in 'key[=value]' format. Use "" to clear existing tags.

az group show

Gets a resource group.

az group show --name

Required Parameters

--name -n

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

az group update

Update a resource group.

az group update --name
[--add]
[--remove]
[--set]

Required Parameters

--name -n

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

Optional Parameters

--add

Add an object to a list of objects by specifying a path and key value pairs. Example: --add property.listProperty .

--remove

Remove a property or an element from a list. Example: --remove property.list OR --remove propertyToRemove.

--set

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

az group wait

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]

Required Parameters

--name -n

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

Optional Parameters

--created

Wait till created with 'provisioningState' at 'Succeeded'.

--custom

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

--deleted

Wait till deleted.

--exists

Wait till the resource exists.

--interval

Polling interval in seconds.

default value: 30
--timeout

Maximum wait in seconds.

default value: 3600
--updated

Wait till updated with provisioningState at 'Succeeded'.