Resource locks - az lock

Manage Azure locks.

Commands

az lock create Create a lock.
az lock delete
az lock list
az lock show
az lock update Update the properties of a lock.

az lock create

Locks can exist at three different scopes, (subscription, resource group and resource).

az lock create --name
[--lock-type {CanNotDelete, NotSpecified, ReadOnly}]
[--namespace]
[--notes]
[--parent]
[--resource-group]
[--resource-name]
[--resource-type]

Examples

Update a subscription level lock with new notes

az lock update --name lockName --resource-group group --notes newNotesHere

Required Parameters

--name -n

The name of the lock.

Optional Parameters

--lock-type -t
accepted values: CanNotDelete, NotSpecified, ReadOnly
--namespace

Provider namespace (Ex: 'Microsoft.Provider').

--notes

Notes about this lock.

--parent

The parent path (Ex: 'resA/myA/resB/myB').

--resource-group -g

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

--resource-name

Name of a resource that has a lock.

--resource-type

The resource type (Ex: 'resC'). Can also accept namespace/type format (Ex: 'Microsoft.Provider/resC').

az lock delete

az lock delete --name
[--namespace]
[--parent]
[--resource-group]
[--resource-name]
[--resource-type]

Required Parameters

--name -n

The name of the lock.

Optional Parameters

--namespace

Provider namespace (Ex: 'Microsoft.Provider').

--parent

The parent path (Ex: 'resA/myA/resB/myB').

--resource-group -g

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

--resource-name

Name of a resource that has a lock.

--resource-type

The resource type (Ex: 'resC'). Can also accept namespace/type format (Ex: 'Microsoft.Provider/resC').

az lock list

az lock list [--filter-string]
[--namespace]
[--parent]
[--resource-group]
[--resource-name]
[--resource-type]

Optional Parameters

--filter-string

A query filter to use to restrict the results.

--namespace

Provider namespace (Ex: 'Microsoft.Provider').

--parent

The parent path (Ex: 'resA/myA/resB/myB').

--resource-group -g

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

--resource-name

Name of a resource that has a lock.

--resource-type

The resource type (Ex: 'resC'). Can also accept namespace/type format (Ex: 'Microsoft.Provider/resC').

az lock show

az lock show --name
[--namespace]
[--parent]
[--resource-group]
[--resource-name]
[--resource-type]

Required Parameters

--name -n

The name of the lock.

Optional Parameters

--namespace

Provider namespace (Ex: 'Microsoft.Provider').

--parent

The parent path (Ex: 'resA/myA/resB/myB').

--resource-group -g

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

--resource-name
--resource-type

The resource type (Ex: 'resC'). Can also accept namespace/type format (Ex: 'Microsoft.Provider/resC').

az lock update

Update the properties of a lock.

az lock update --name
[--lock-type {CanNotDelete, NotSpecified, ReadOnly}]
[--notes]
[--resource-group]

Examples

Update a subscription level lock with new notes

az lock update --name lockName --resource-group group --notes newNotesHere

Required Parameters

--name -n

Optional Parameters

--lock-type -t
accepted values: CanNotDelete, NotSpecified, ReadOnly
--notes

Notes about this lock.

--resource-group -g

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