שתף באמצעות


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

--lock-type -t

The type of lock restriction.

Accepted values: CanNotDelete, ReadOnly
--name -n

Name of the lock.

Optional Parameters

--namespace

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

--notes

Notes about this lock.

--parent

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

--resource --resource-name

If an ID is given, other resource arguments should not be given.

--resource-group -g

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

--resource-type

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

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.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--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 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

--ids

One or more resource IDs (space-delimited). If provided, no other "Resource Id" arguments should be specified.

--name -n

Name of the lock.

--namespace

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

--parent

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

--resource --resource-name

If an ID is given, other resource arguments should not be given.

--resource-group -g

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

--resource-type

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

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.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--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 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

--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 --resource-name

If an ID is given, other resource arguments should not be given.

--resource-group -g

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

--resource-type

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

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.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--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 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

--ids

One or more resource IDs (space-delimited). If provided, no other "Resource Id" arguments should be specified.

--name -n

Name of the lock.

--namespace

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

--parent

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

--resource --resource-name

If an ID is given, other resource arguments should not be given.

--resource-group -g

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

--resource-type

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

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.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--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 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

--ids

One or more resource IDs (space-delimited). If provided, no other "Resource Id" arguments should be specified.

--lock-type -t

The type of lock restriction.

Accepted values: CanNotDelete, ReadOnly
--name -n

Name of the lock.

--namespace

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

--notes

Notes about this lock.

--parent

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

--resource --resource-name

If an ID is given, other resource arguments should not be given.

--resource-group -g

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

--resource-type

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

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.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--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.