az resource lock
Manage Azure resource level locks.
Commands
Name | Description | Type | Status |
---|---|---|---|
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 lock create
Create a resource-level lock.
az resource lock create --lock-type {CanNotDelete, ReadOnly}
--name
[--namespace]
[--notes]
[--parent]
[--resource]
[--resource-group]
[--resource-type]
Examples
Create a read-only resource level lock on a vnet.
az resource lock create --lock-type ReadOnly -n lockName -g MyResourceGroup --resource myvnet --resource-type Microsoft.Network/virtualNetworks
Create a read-only resource level lock on a vnet using a vnet id.
az resource lock create --lock-type ReadOnly -n lockName --resource /subscriptions/{SubID}/resourceGroups/{ResourceGroup}/providers/Microsoft.Network/virtualNetworks/{VNETName}
Required Parameters
The type of lock restriction.
Name of the lock.
Optional Parameters
Provider namespace (Ex: 'Microsoft.Provider').
Notes about this lock.
The parent path (Ex: 'resA/myA/resB/myB').
If an ID is given, other resource arguments should not be given.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
The resource type (Ex: 'resC'). Can also accept namespace/type format (Ex: 'Microsoft.Provider/resC').
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
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.
az resource lock delete
Delete a resource-level lock.
az resource lock delete [--ids]
[--name]
[--namespace]
[--parent]
[--resource]
[--resource-group]
[--resource-type]
Examples
Delete a resource level lock
az resource lock delete --name lockName -g MyResourceGroup --resource myvnet --resource-type Microsoft.Network/virtualNetworks
Delete a resource level lock on a vnet using a vnet id.
az resource lock delete -n lockName --resource /subscriptions/{SubID}/resourceGroups/{ResourceGroup}/providers/Microsoft.Network/virtualNetworks/{VMName}
Delete a resource-level lock. (autogenerated)
az resource lock delete --ids /subscriptions/{SubID}/resourceGroups/{ResourceGroup}/providers/Microsoft.Web/sites/{WebApp}
Optional Parameters
One or more resource IDs (space-delimited). If provided, no other "Resource Id" arguments should be specified.
Name of the lock.
Provider namespace (Ex: 'Microsoft.Provider').
The parent path (Ex: 'resA/myA/resB/myB').
If an ID is given, other resource arguments should not be given.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
The resource type (Ex: 'resC'). Can also accept namespace/type format (Ex: 'Microsoft.Provider/resC').
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
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.
az resource lock list
List lock information in the resource-level.
az resource lock list [--filter-string]
[--namespace]
[--parent]
[--resource]
[--resource-group]
[--resource-type]
Examples
List out all locks on a vnet
az resource lock list -g MyResourceGroup --resource myvnet --resource-type Microsoft.Network/virtualNetworks
Optional Parameters
A query filter to use to restrict the results.
Provider namespace (Ex: 'Microsoft.Provider').
The parent path (Ex: 'resA/myA/resB/myB').
If an ID is given, other resource arguments should not be given.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
The resource type (Ex: 'resC'). Can also accept namespace/type format (Ex: 'Microsoft.Provider/resC').
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
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.
az resource lock show
Show the details of a resource-level lock.
az resource lock show [--ids]
[--name]
[--namespace]
[--parent]
[--resource]
[--resource-group]
[--resource-type]
Examples
Show a resource level lock
az resource lock show -n lockname -g MyResourceGroup --resource myvnet --resource-type Microsoft.Network/virtualNetworks
Optional Parameters
One or more resource IDs (space-delimited). If provided, no other "Resource Id" arguments should be specified.
Name of the lock.
Provider namespace (Ex: 'Microsoft.Provider').
The parent path (Ex: 'resA/myA/resB/myB').
If an ID is given, other resource arguments should not be given.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
The resource type (Ex: 'resC'). Can also accept namespace/type format (Ex: 'Microsoft.Provider/resC').
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
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.
az resource lock update
Update a resource-level lock.
az resource lock update [--ids]
[--lock-type {CanNotDelete, ReadOnly}]
[--name]
[--namespace]
[--notes]
[--parent]
[--resource]
[--resource-group]
[--resource-type]
Examples
Update a resource level lock with new notes and type
az resource lock update --name lockName -g MyResourceGroup --resource myvnet --resource-type Microsoft.Network/virtualNetworks --notes newNotesHere --lock-type CanNotDelete
Update a resource-level lock. (autogenerated)
az resource lock update --lock-type CanNotDelete --name lockName --namespace Microsoft.Network --resource-group MyResourceGroup --resource-name myvnet --resource-type Microsoft.Network/virtualNetworks
Optional Parameters
One or more resource IDs (space-delimited). If provided, no other "Resource Id" arguments should be specified.
The type of lock restriction.
Name of the lock.
Provider namespace (Ex: 'Microsoft.Provider').
Notes about this lock.
The parent path (Ex: 'resA/myA/resB/myB').
If an ID is given, other resource arguments should not be given.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
The resource type (Ex: 'resC'). Can also accept namespace/type format (Ex: 'Microsoft.Provider/resC').
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
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.
Azure CLI