az resource
Manage Azure resources.
Commands
Name | Description | Type | Status |
---|---|---|---|
az resource create |
Create a resource. |
Core | GA |
az resource delete |
Delete a resource. |
Core | GA |
az resource invoke-action |
Invoke an action on the resource. |
Core | GA |
az resource link |
Manage links between resources. |
Core | GA |
az resource link create |
Create a new link between resources. |
Core | GA |
az resource link delete |
Delete a link between resources. |
Core | GA |
az resource link list |
List resource links. |
Core | GA |
az resource link show |
Gets a resource link with the specified ID. |
Core | GA |
az resource link update |
Update link between resources. |
Core | GA |
az resource list |
List resources. |
Core | GA |
az resource lock |
Manage Azure resource level locks. |
Core | GA |
az resource lock create |
Create a resource-level lock. |
Core | GA |
az resource lock delete |
Delete a resource-level lock. |
Core | GA |
az resource lock list |
List lock information in the resource-level. |
Core | GA |
az resource lock show |
Show the details of a resource-level lock. |
Core | GA |
az resource lock update |
Update a resource-level lock. |
Core | GA |
az resource move |
Move resources from one resource group to another (can be under different subscription). |
Core | GA |
az resource patch |
Update a resource by PATCH request. |
Core | GA |
az resource show |
Get the details of a resource. |
Core | GA |
az resource tag |
Tag a resource. |
Core | GA |
az resource update |
Update a resource by PUT request. |
Core | GA |
az resource wait |
Place the CLI in a waiting state until a condition of a resources is met. |
Core | GA |
az resource create
Create a resource.
az resource create --properties
[--api-version]
[--id]
[--is-full-object]
[--latest-include-preview]
[--location]
[--name]
[--namespace]
[--parent]
[--resource-group]
[--resource-type]
Examples
Create an API app by providing a full JSON configuration.
az resource create -g myRG -n myApiApp --resource-type Microsoft.web/sites \
--is-full-object --properties "{ \"kind\": \"api\", \"location\": \
\"West US\", \"properties\": { \"serverFarmId\": \
\"/subscriptions/{SubID}/resourcegroups/{ResourceGroup} \
/providers/Microsoft.Web/serverfarms/{ServicePlan}\" } }"
Create a resource by loading JSON configuration from a file.
az resource create -g myRG -n myApiApp --resource-type Microsoft.web/sites --is-full-object --properties @jsonConfigFile
Create a web app with the minimum required configuration information.
az resource create -g myRG -n myWeb --resource-type Microsoft.web/sites \
--properties "{ \"serverFarmId\":\"/subscriptions/{SubID}/resourcegroups/ \
{ResourceGroup}/providers/Microsoft.Web/serverfarms/{ServicePlan}\" }"
Create a resource by using the latest api-version whether this version is a preview version.
az resource create -g myRG -n myApiApp --resource-type Microsoft.web/sites --is-full-object --properties @jsonConfigFile --latest-include-preview
Create a site extension to a web app
az resource create -g myRG --api-version "2018-02-01" \
--name "{sitename+slot}/siteextensions/Contrast.NetCore.Azure.SiteExtension" \
--resource-type Microsoft.Web/sites/siteextensions --is-full-object \
--properties "{ \"id\": \"Contrast.NetCore.Azure.SiteExtension\", \
\"location\": \"West US\", \"version\": \"1.9.0\" }"
Required Parameters
A JSON-formatted string containing resource properties.
Optional Parameters
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
The api version of the resource (omit for the latest stable version).
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Resource ID.
Indicate that the properties object includes other options such as location, tags, sku, and/or plan.
Property | Value |
---|---|
Default value: | False |
Indicate that the latest api-version will be used regardless of whether it is preview version (like 2020-01-01-preview) or not. For example, if the supported api-version of resource provider is 2020-01-01-preview and 2019-01-01: when passing in this parameter it will take the latest version 2020-01-01-preview, otherwise it will take the latest stable version 2019-01-01 without passing in this parameter.
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Default value: | False |
Location. Values from: az account list-locations
. You can configure the default location using az configure --defaults location=<location>
.
The resource name. (Ex: myC).
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Provider namespace (Ex: 'Microsoft.Provider').
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
The parent path (Ex: 'resA/myA/resB/myB').
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
The resource type (Ex: 'resC'). Can also accept namespace/type format (Ex: 'Microsoft.Provider/resC').
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Global Parameters
Increase logging verbosity to show all debug logs.
Property | Value |
---|---|
Default value: | False |
Show this help message and exit.
Only show errors, suppressing warnings.
Property | Value |
---|---|
Default value: | False |
Output format.
Property | Value |
---|---|
Default value: | json |
Accepted values: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
Property | Value |
---|---|
Default value: | False |
az resource delete
Delete a resource.
az resource delete [--api-version]
[--ids]
[--latest-include-preview]
[--name]
[--namespace]
[--no-wait]
[--parent]
[--resource-group]
[--resource-type]
Examples
Delete a virtual machine named 'MyVm'.
az resource delete -g MyResourceGroup -n MyVm --resource-type "Microsoft.Compute/virtualMachines"
Delete a web app using a resource identifier.
az resource delete --ids /subscriptions/0b1f6471-1bf0-4dda-aec3-111111111111/resourceGroups/MyResourceGroup/providers/Microsoft.Web/sites/MyWebapp
Delete a subnet using a resource identifier.
az resource delete --ids /subscriptions/0b1f6471-1bf0-4dda-aec3-111111111111/resourceGroups/MyResourceGroup/providers/Microsoft.Network/virtualNetworks/MyVnet/subnets/MySubnet
Delete a virtual machine named 'MyVm' by using the latest api-version whether this version is a preview version.
az resource delete -g MyResourceGroup -n MyVm --resource-type "Microsoft.Compute/virtualMachines" --latest-include-preview
Optional Parameters
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
The api version of the resource (omit for the latest stable version).
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
One or more resource IDs (space-delimited). If provided, no other "Resource Id" arguments should be specified.
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Indicate that the latest api-version will be used regardless of whether it is preview version (like 2020-01-01-preview) or not. For example, if the supported api-version of resource provider is 2020-01-01-preview and 2019-01-01: when passing in this parameter it will take the latest version 2020-01-01-preview, otherwise it will take the latest stable version 2019-01-01 without passing in this parameter.
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Default value: | False |
The resource name. (Ex: myC).
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Provider namespace (Ex: 'Microsoft.Provider').
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Do not wait for the long-running operation to finish.
Property | Value |
---|---|
Default value: | False |
The parent path (Ex: 'resA/myA/resB/myB').
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
The resource type (Ex: 'resC'). Can also accept namespace/type format (Ex: 'Microsoft.Provider/resC').
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Global Parameters
Increase logging verbosity to show all debug logs.
Property | Value |
---|---|
Default value: | False |
Show this help message and exit.
Only show errors, suppressing warnings.
Property | Value |
---|---|
Default value: | False |
Output format.
Property | Value |
---|---|
Default value: | json |
Accepted values: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
Property | Value |
---|---|
Default value: | False |
az resource invoke-action
Invoke an action on the resource.
A list of possible actions corresponding to a resource can be found at https://learn.microsoft.com/rest/api/. All POST requests are actions that can be invoked and are specified at the end of the URI path. For instance, to stop a VM, the request URI is https://management.azure.com/subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroup}/providers/Microsoft.Compute/virtualMachines/{VM}/powerOff?api-version={APIVersion}
and the corresponding action is powerOff
. This can be found at https://learn.microsoft.com/rest/api/compute/virtualmachines/virtualmachines-stop.
az resource invoke-action --action
[--api-version]
[--ids]
[--latest-include-preview]
[--name]
[--namespace]
[--no-wait]
[--parent]
[--request-body]
[--resource-group]
[--resource-type]
Examples
Power-off a vm, specified by Id.
az resource invoke-action --action powerOff \
--ids /subscriptions/{SubID}/resourceGroups/{ResourceGroup}/providers/Microsoft.Compute/virtualMachines/{VMName}
Capture information for a stopped vm.
az resource invoke-action --action capture \
--ids /subscriptions/{SubID}/resourceGroups/{ResourceGroup}/providers/ \
Microsoft.Compute/virtualMachines/{VMName} \
--request-body "{ \"vhdPrefix\": \"myPrefix\", \"destinationContainerName\": \
\"myContainer\", \"overwriteVhds\": true }"
Invoke an action on the resource. (autogenerated)
az resource invoke-action --action capture --name MyResource --resource-group MyResourceGroup --resource-type Microsoft.web/sites
Required Parameters
The action that will be invoked on the specified resource.
Optional Parameters
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
The api version of the resource (omit for the latest stable version).
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
One or more resource IDs (space-delimited). If provided, no other "Resource Id" arguments should be specified.
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Indicate that the latest api-version will be used regardless of whether it is preview version (like 2020-01-01-preview) or not. For example, if the supported api-version of resource provider is 2020-01-01-preview and 2019-01-01: when passing in this parameter it will take the latest version 2020-01-01-preview, otherwise it will take the latest stable version 2019-01-01 without passing in this parameter.
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Default value: | False |
The resource name. (Ex: myC).
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Provider namespace (Ex: 'Microsoft.Provider').
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Do not wait for the long-running operation to finish.
Property | Value |
---|---|
Default value: | False |
The parent path (Ex: 'resA/myA/resB/myB').
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
JSON encoded parameter arguments for the action that will be passed along in the post request body. Use @{file} to load from a file.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
The resource type (Ex: 'resC'). Can also accept namespace/type format (Ex: 'Microsoft.Provider/resC').
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Global Parameters
Increase logging verbosity to show all debug logs.
Property | Value |
---|---|
Default value: | False |
Show this help message and exit.
Only show errors, suppressing warnings.
Property | Value |
---|---|
Default value: | False |
Output format.
Property | Value |
---|---|
Default value: | json |
Accepted values: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
Property | Value |
---|---|
Default value: | False |
az resource list
List resources.
az resource list [--location]
[--name]
[--namespace]
[--resource-group]
[--resource-type]
[--tag]
Examples
List all resources in the West US region.
az resource list --location westus
List all resources with the name 'resourceName'.
az resource list --name 'resourceName'
List all resources with the tag 'test'.
az resource list --tag test
List all resources with a tag that starts with 'test'.
az resource list --tag 'test*'
List all resources with the tag 'test' that have the value 'example'.
az resource list --tag test=example
Optional Parameters
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
Location. Values from: az account list-locations
. You can configure the default location using az configure --defaults location=<location>
.
The resource name. (Ex: myC).
Provider namespace (Ex: 'Microsoft.Provider').
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
The resource type (Ex: 'resC'). Can also accept namespace/type format (Ex: 'Microsoft.Provider/resC').
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
A single tag in 'key[=value]' format. Use "" to clear existing tags.
Global Parameters
Increase logging verbosity to show all debug logs.
Property | Value |
---|---|
Default value: | False |
Show this help message and exit.
Only show errors, suppressing warnings.
Property | Value |
---|---|
Default value: | False |
Output format.
Property | Value |
---|---|
Default value: | json |
Accepted values: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
Property | Value |
---|---|
Default value: | False |
az resource move
Move resources from one resource group to another (can be under different subscription).
az resource move --destination-group
--ids
[--destination-subscription-id]
Examples
Move multiple resources to the destination resource group under the destination subscription
az resource move --destination-group ResourceGroup --destination-subscription-id SubscriptionId --ids "ResourceId1" "ResourceId2" "ResourceId3"
Required Parameters
The destination resource group name.
The space-separated resource ids to be moved.
Optional Parameters
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
The destination subscription identifier.
Global Parameters
Increase logging verbosity to show all debug logs.
Property | Value |
---|---|
Default value: | False |
Show this help message and exit.
Only show errors, suppressing warnings.
Property | Value |
---|---|
Default value: | False |
Output format.
Property | Value |
---|---|
Default value: | json |
Accepted values: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
Property | Value |
---|---|
Default value: | False |
az resource patch
Update a resource by PATCH request.
It supports updating resources with JSON-formatted string. If the patch operation fails, please try run 'az resource update' instead.
az resource patch --properties
[--api-version]
[--ids]
[--is-full-object]
[--latest-include-preview]
[--name]
[--namespace]
[--parent]
[--resource-group]
[--resource-type]
Examples
Update a webapp by using the latest api-version whether this version is a preview version.
az resource patch --ids /subscriptions/{SubID}/resourceGroups/{ResourceGroup}/providers/Microsoft.Web/sites/{WebApp} \
--latest-include-preview --is-full-object --properties "{ \"tags\": { \"key\": \"value\" } }"
Update a resource by using JSON configuration from a file.
az resource patch --name MyResource --resource-group MyResourceGroup --resource-type Microsoft.web/sites \
--is-full-object --properties @jsonConfigFile
Update an API app by providing a JSON configuration.
az resource patch --name MyApiApp --resource-group MyResourceGroup --resource-type Microsoft.web/sites \
--is-full-object --properties "{ \"kind\": \"api\", \"properties\": { \"serverFarmId\": \
\"/subscriptions/{SubID}/resourcegroups/{ResourceGroup} \
/providers/Microsoft.Web/serverfarms/{ServicePlan}\" } }"
Required Parameters
A JSON-formatted string containing resource properties.
Optional Parameters
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
The api version of the resource (omit for the latest stable version).
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
One or more resource IDs (space-delimited). If provided, no other "Resource Id" arguments should be specified.
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Indicate that the properties object includes other options such as location, tags, sku, and/or plan.
Property | Value |
---|---|
Default value: | False |
Indicate that the latest api-version will be used regardless of whether it is preview version (like 2020-01-01-preview) or not. For example, if the supported api-version of resource provider is 2020-01-01-preview and 2019-01-01: when passing in this parameter it will take the latest version 2020-01-01-preview, otherwise it will take the latest stable version 2019-01-01 without passing in this parameter.
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Default value: | False |
The resource name. (Ex: myC).
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Provider namespace (Ex: 'Microsoft.Provider').
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
The parent path (Ex: 'resA/myA/resB/myB').
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
The resource type (Ex: 'resC'). Can also accept namespace/type format (Ex: 'Microsoft.Provider/resC').
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Global Parameters
Increase logging verbosity to show all debug logs.
Property | Value |
---|---|
Default value: | False |
Show this help message and exit.
Only show errors, suppressing warnings.
Property | Value |
---|---|
Default value: | False |
Output format.
Property | Value |
---|---|
Default value: | json |
Accepted values: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
Property | Value |
---|---|
Default value: | False |
az resource show
Get the details of a resource.
az resource show [--api-version]
[--ids]
[--include-response-body {false, true}]
[--latest-include-preview]
[--name]
[--namespace]
[--parent]
[--resource-group]
[--resource-type]
Examples
Show a virtual machine resource named 'MyVm'.
az resource show -g MyResourceGroup -n MyVm --resource-type "Microsoft.Compute/virtualMachines"
Show a web app using a resource identifier.
az resource show --ids /subscriptions/0b1f6471-1bf0-4dda-aec3-111111111111/resourceGroups/MyResourceGroup/providers/Microsoft.Web/sites/MyWebapp
Show a subnet.
az resource show -g MyResourceGroup -n MySubnet --namespace Microsoft.Network --parent virtualnetworks/MyVnet --resource-type subnets
Show a subnet using a resource identifier.
az resource show --ids /subscriptions/0b1f6471-1bf0-4dda-aec3-111111111111/resourceGroups/MyResourceGroup/providers/Microsoft.Network/virtualNetworks/MyVnet/subnets/MySubnet
Show an application gateway path rule.
az resource show -g MyResourceGroup --namespace Microsoft.Network --parent applicationGateways/ag1/urlPathMaps/map1 --resource-type pathRules -n rule1
Show a virtual machine resource named 'MyVm' by using the latest api-version whether this version is a preview version.
az resource show -g MyResourceGroup -n MyVm --resource-type "Microsoft.Compute/virtualMachines" --latest-include-preview
Optional Parameters
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
The api version of the resource (omit for the latest stable version).
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
One or more resource IDs (space-delimited). If provided, no other "Resource Id" arguments should be specified.
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Use if the default command output doesn't capture all of the property data.
Property | Value |
---|---|
Default value: | False |
Accepted values: | false, true |
Indicate that the latest api-version will be used regardless of whether it is preview version (like 2020-01-01-preview) or not. For example, if the supported api-version of resource provider is 2020-01-01-preview and 2019-01-01: when passing in this parameter it will take the latest version 2020-01-01-preview, otherwise it will take the latest stable version 2019-01-01 without passing in this parameter.
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Default value: | False |
The resource name. (Ex: myC).
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Provider namespace (Ex: 'Microsoft.Provider').
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
The parent path (Ex: 'resA/myA/resB/myB').
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
The resource type (Ex: 'resC'). Can also accept namespace/type format (Ex: 'Microsoft.Provider/resC').
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Global Parameters
Increase logging verbosity to show all debug logs.
Property | Value |
---|---|
Default value: | False |
Show this help message and exit.
Only show errors, suppressing warnings.
Property | Value |
---|---|
Default value: | False |
Output format.
Property | Value |
---|---|
Default value: | json |
Accepted values: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
Property | Value |
---|---|
Default value: | False |
az resource tag
Tag a resource.
az resource tag --tags
[--api-version]
[--ids]
[--is-incremental]
[--latest-include-preview]
[--name]
[--namespace]
[--parent]
[--resource-group]
[--resource-type]
Examples
Tag the virtual machine 'MyVm' with the key 'vmlist' and value 'vm1'.
az resource tag --tags vmlist=vm1 -g MyResourceGroup -n MyVm --resource-type "Microsoft.Compute/virtualMachines"
Tag a web app with the key 'vmlist' and value 'vm1', using a resource identifier.
az resource tag --tags vmlist=vm1 --ids /subscriptions/{SubID}/resourceGroups/{ResourceGroup}/providers/Microsoft.Web/sites/{WebApp}
Tag the virtual machine 'MyVm' with the key 'vmlist' and value 'vm1' incrementally. It doesn't empty the existing tags.
az resource tag --tags vmlist=vm1 -g MyResourceGroup -n MyVm --resource-type "Microsoft.Compute/virtualMachines" -i
Tag the virtual machine 'MyVm' with the key 'vmlist' and value 'vm1' by using the latest api-version whether this version is a preview version.
az resource tag --tags vmlist=vm1 -g MyResourceGroup -n MyVm --resource-type "Microsoft.Compute/virtualMachines" --latest-include-preview
Required Parameters
Space-separated tags: key[=value] [key[=value] ...]. Use "" to clear existing tags.
Optional Parameters
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
The api version of the resource (omit for the latest stable version).
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
One or more resource IDs (space-delimited). If provided, no other "Resource Id" arguments should be specified.
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
The option to add tags incrementally without deleting the original tags. If the key of new tag and original tag are duplicated, the original value will be overwritten.
Indicate that the latest api-version will be used regardless of whether it is preview version (like 2020-01-01-preview) or not. For example, if the supported api-version of resource provider is 2020-01-01-preview and 2019-01-01: when passing in this parameter it will take the latest version 2020-01-01-preview, otherwise it will take the latest stable version 2019-01-01 without passing in this parameter.
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Default value: | False |
The resource name. (Ex: myC).
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Provider namespace (Ex: 'Microsoft.Provider').
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
The parent path (Ex: 'resA/myA/resB/myB').
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
The resource type (Ex: 'resC'). Can also accept namespace/type format (Ex: 'Microsoft.Provider/resC').
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Global Parameters
Increase logging verbosity to show all debug logs.
Property | Value |
---|---|
Default value: | False |
Show this help message and exit.
Only show errors, suppressing warnings.
Property | Value |
---|---|
Default value: | False |
Output format.
Property | Value |
---|---|
Default value: | json |
Accepted values: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
Property | Value |
---|---|
Default value: | False |
az resource update
Update a resource by PUT request.
It supports the generic update (using property path) to update resources. If the update operation fails, please try run 'az resource patch' instead.
az resource update [--add]
[--api-version]
[--force-string]
[--ids]
[--include-response-body {false, true}]
[--latest-include-preview]
[--name]
[--namespace]
[--parent]
[--remove]
[--resource-group]
[--resource-type]
[--set]
Examples
Update a webapp by using the latest api-version whether this version is a preview version.
az resource update --ids /subscriptions/{SubID}/resourceGroups/{ResourceGroup}/providers/Microsoft.Web/sites/{WebApp} --set tags.key=value --latest-include-preview
Update a resource. (autogenerated)
az resource update --ids $id --set properties.connectionType=Proxy
Update a resource. (autogenerated)
az resource update --name MyResource --resource-group MyResourceGroup --resource-type subnets --set tags.key=value
Optional Parameters
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
Add an object to a list of objects by specifying a path and key value pairs. Example: --add property.listProperty <key=value, string or JSON string>
.
Property | Value |
---|---|
Parameter group: | Generic Update Arguments |
Default value: | [] |
The api version of the resource (omit for the latest stable version).
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
When using 'set' or 'add', preserve string literals instead of attempting to convert to JSON.
Property | Value |
---|---|
Parameter group: | Generic Update Arguments |
Default value: | False |
One or more resource IDs (space-delimited). If provided, no other "Resource Id" arguments should be specified.
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Use if the default command output doesn't capture all of the property data.
Property | Value |
---|---|
Default value: | False |
Accepted values: | false, true |
Indicate that the latest api-version will be used regardless of whether it is preview version (like 2020-01-01-preview) or not. For example, if the supported api-version of resource provider is 2020-01-01-preview and 2019-01-01: when passing in this parameter it will take the latest version 2020-01-01-preview, otherwise it will take the latest stable version 2019-01-01 without passing in this parameter.
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Default value: | False |
The resource name. (Ex: myC).
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Provider namespace (Ex: 'Microsoft.Provider').
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
The parent path (Ex: 'resA/myA/resB/myB').
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Remove a property or an element from a list. Example: --remove property.list <indexToRemove>
OR --remove propertyToRemove
.
Property | Value |
---|---|
Parameter group: | Generic Update Arguments |
Default value: | [] |
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
The resource type (Ex: 'resC'). Can also accept namespace/type format (Ex: 'Microsoft.Provider/resC').
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Update an object by specifying a property path and value to set. Example: --set property1.property2=<value>
.
Property | Value |
---|---|
Parameter group: | Generic Update Arguments |
Default value: | [] |
Global Parameters
Increase logging verbosity to show all debug logs.
Property | Value |
---|---|
Default value: | False |
Show this help message and exit.
Only show errors, suppressing warnings.
Property | Value |
---|---|
Default value: | False |
Output format.
Property | Value |
---|---|
Default value: | json |
Accepted values: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
Property | Value |
---|---|
Default value: | False |
az resource wait
Place the CLI in a waiting state until a condition of a resources is met.
az resource wait [--api-version]
[--created]
[--custom]
[--deleted]
[--exists]
[--ids]
[--include-response-body {false, true}]
[--interval]
[--name]
[--namespace]
[--parent]
[--resource-group]
[--resource-type]
[--timeout]
[--updated]
Examples
Place the CLI in a waiting state until a condition of a resources is met. (autogenerated)
az resource wait --exists --ids /subscriptions/{SubID}/resourceGroups/{ResourceGroup}/providers/Microsoft.Web/sites/{WebApp}
Place the CLI in a waiting state until a condition of a resources is met. (autogenerated)
az resource wait --exists --ids /subscriptions/{SubID}/resourceGroups/{ResourceGroup}/providers/Microsoft.Web/sites/{WebApp} --include-response-body true
Place the CLI in a waiting state until a condition of a resources is met. (autogenerated)
az resource wait --exists --name MyResource --resource-group MyResourceGroup --resource-type subnets
Optional Parameters
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
The api version of the resource (omit for the latest stable version).
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Wait until created with 'provisioningState' at 'Succeeded'.
Property | Value |
---|---|
Parameter group: | Wait Condition Arguments |
Default value: | False |
Wait until the condition satisfies a custom JMESPath query. E.g. provisioningState!='InProgress', instanceView.statuses[?code=='PowerState/running'].
Property | Value |
---|---|
Parameter group: | Wait Condition Arguments |
Wait until deleted.
Property | Value |
---|---|
Parameter group: | Wait Condition Arguments |
Default value: | False |
Wait until the resource exists.
Property | Value |
---|---|
Parameter group: | Wait Condition Arguments |
Default value: | False |
One or more resource IDs (space-delimited). If provided, no other "Resource Id" arguments should be specified.
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Use if the default command output doesn't capture all of the property data.
Property | Value |
---|---|
Default value: | False |
Accepted values: | false, true |
Polling interval in seconds.
Property | Value |
---|---|
Parameter group: | Wait Condition Arguments |
Default value: | 30 |
The resource name. (Ex: myC).
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Provider namespace (Ex: 'Microsoft.Provider').
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
The parent path (Ex: 'resA/myA/resB/myB').
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
The resource type (Ex: 'resC'). Can also accept namespace/type format (Ex: 'Microsoft.Provider/resC').
Property | Value |
---|---|
Parameter group: | Resource Id Arguments |
Maximum wait in seconds.
Property | Value |
---|---|
Parameter group: | Wait Condition Arguments |
Default value: | 3600 |
Wait until updated with provisioningState at 'Succeeded'.
Property | Value |
---|---|
Parameter group: | Wait Condition Arguments |
Default value: | False |
Global Parameters
Increase logging verbosity to show all debug logs.
Property | Value |
---|---|
Default value: | False |
Show this help message and exit.
Only show errors, suppressing warnings.
Property | Value |
---|---|
Default value: | False |
Output format.
Property | Value |
---|---|
Default value: | json |
Accepted values: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
Property | Value |
---|---|
Default value: | False |