Skip to main content

management_locks

Creates, updates, deletes, gets or lists a management_locks resource.

Overview

Namemanagement_locks
TypeResource
Idazure.resource.management_locks

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringThe resource ID of the lock.
namestringThe name of the lock.
levelstringThe level of the lock. Possible values are: NotSpecified, CanNotDelete, ReadOnly. CanNotDelete means authorized users are able to read and modify the resources, but not delete. ReadOnly means authorized users can only read from a resource, but they can't modify or delete it. Required. Known values are: "NotSpecified", "CanNotDelete", and "ReadOnly".
notesstringNotes about the lock. Maximum of 512 characters.
ownersarrayThe owners of the lock.
typestringThe resource type of the lock - Microsoft.Authorization/locks.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_at_resource_levelselectresource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, lock_name, subscription_idGet the management lock of a resource or any level below resource.
list_at_resource_levelselectresource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, subscription_id$filterGets all the management locks for a resource or any level below resource.
get_at_resource_group_levelselectresource_group_name, lock_name, subscription_idGets a management lock at the resource group level.
list_at_resource_group_levelselectresource_group_name, subscription_id$filterGets all the management locks for a resource group.
get_by_scopeselectscope, lock_nameGet a management lock by scope.
get_at_subscription_levelselectlock_name, subscription_idGets a management lock at the subscription level.
list_by_scopeselectscope$filterGets all the management locks for a scope.
list_at_subscription_levelselectsubscription_id$filterGets all the management locks for a subscription.
create_or_update_at_resource_levelinsertresource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, lock_name, subscription_id, propertiesCreates or updates a management lock at the resource level or any level below the resource. When you apply a lock at a parent scope, all child resources inherit the same lock. To create management locks, you must have access to Microsoft.Authorization/\ * or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted those actions.
create_or_update_at_resource_group_levelinsertresource_group_name, lock_name, subscription_id, propertiesCreates or updates a management lock at the resource group level. When you apply a lock at a parent scope, all child resources inherit the same lock. To create management locks, you must have access to Microsoft.Authorization/\ * or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted those actions.
create_or_update_by_scopeinsertscope, lock_name, propertiesCreate or update a management lock by scope.
create_or_update_at_subscription_levelinsertlock_name, subscription_id, propertiesCreates or updates a management lock at the subscription level. When you apply a lock at a parent scope, all child resources inherit the same lock. To create management locks, you must have access to Microsoft.Authorization/\ * or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted those actions.
create_or_update_at_resource_levelreplaceresource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, lock_name, subscription_id, propertiesCreates or updates a management lock at the resource level or any level below the resource. When you apply a lock at a parent scope, all child resources inherit the same lock. To create management locks, you must have access to Microsoft.Authorization/\ * or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted those actions.
create_or_update_at_resource_group_levelreplaceresource_group_name, lock_name, subscription_id, propertiesCreates or updates a management lock at the resource group level. When you apply a lock at a parent scope, all child resources inherit the same lock. To create management locks, you must have access to Microsoft.Authorization/\ * or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted those actions.
create_or_update_by_scopereplacescope, lock_name, propertiesCreate or update a management lock by scope.
create_or_update_at_subscription_levelreplacelock_name, subscription_id, propertiesCreates or updates a management lock at the subscription level. When you apply a lock at a parent scope, all child resources inherit the same lock. To create management locks, you must have access to Microsoft.Authorization/\ * or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted those actions.
delete_at_resource_leveldeleteresource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, lock_name, subscription_idDeletes the management lock of a resource or any level below the resource. To delete management locks, you must have access to Microsoft.Authorization/\ * or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted those actions.
delete_at_resource_group_leveldeleteresource_group_name, lock_name, subscription_idDeletes a management lock at the resource group level. To delete management locks, you must have access to Microsoft.Authorization/\ * or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted those actions.
delete_by_scopedeletescope, lock_nameDelete a management lock by scope.
delete_at_subscription_leveldeletelock_name, subscription_idDeletes the management lock at the subscription level. To delete management locks, you must have access to Microsoft.Authorization/\ * or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted those actions.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
lock_namestringThe name of lock to delete. Required.
parent_resource_pathstringThe parent resource identity. Required.
resource_group_namestringThe name of the resource group containing the lock. Required.
resource_namestringThe name of the resource with the lock to delete. Required.
resource_provider_namespacestringThe resource provider namespace of the resource with the lock to delete. Required.
resource_typestringThe resource type of the resource with the lock to delete. Required.
scopestringThe scope for the lock. Required.
subscription_idstring
$filterstringThe filter to apply on the operation. Default value is None.

SELECT examples

Get the management lock of a resource or any level below resource.

SELECT
id,
name,
level,
notes,
owners,
type
FROM azure.resource.management_locks
WHERE resource_group_name = '{{ resource_group_name }}' -- required
AND resource_provider_namespace = '{{ resource_provider_namespace }}' -- required
AND parent_resource_path = '{{ parent_resource_path }}' -- required
AND resource_type = '{{ resource_type }}' -- required
AND resource_name = '{{ resource_name }}' -- required
AND lock_name = '{{ lock_name }}' -- required
AND subscription_id = '{{ subscription_id }}' -- required
;

INSERT examples

Creates or updates a management lock at the resource level or any level below the resource. When you apply a lock at a parent scope, all child resources inherit the same lock. To create management locks, you must have access to Microsoft.Authorization/\ * or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted those actions.

INSERT INTO azure.resource.management_locks (
properties,
resource_group_name,
resource_provider_namespace,
parent_resource_path,
resource_type,
resource_name,
lock_name,
subscription_id
)
SELECT
'{{ properties }}' /* required */,
'{{ resource_group_name }}',
'{{ resource_provider_namespace }}',
'{{ parent_resource_path }}',
'{{ resource_type }}',
'{{ resource_name }}',
'{{ lock_name }}',
'{{ subscription_id }}'
RETURNING
id,
name,
properties,
type
;

REPLACE examples

Creates or updates a management lock at the resource level or any level below the resource. When you apply a lock at a parent scope, all child resources inherit the same lock. To create management locks, you must have access to Microsoft.Authorization/\ * or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted those actions.

REPLACE azure.resource.management_locks
SET
properties = '{{ properties }}'
WHERE
resource_group_name = '{{ resource_group_name }}' --required
AND resource_provider_namespace = '{{ resource_provider_namespace }}' --required
AND parent_resource_path = '{{ parent_resource_path }}' --required
AND resource_type = '{{ resource_type }}' --required
AND resource_name = '{{ resource_name }}' --required
AND lock_name = '{{ lock_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
AND properties = '{{ properties }}' --required
RETURNING
id,
name,
properties,
type;

DELETE examples

Deletes the management lock of a resource or any level below the resource. To delete management locks, you must have access to Microsoft.Authorization/\ * or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted those actions.

DELETE FROM azure.resource.management_locks
WHERE resource_group_name = '{{ resource_group_name }}' --required
AND resource_provider_namespace = '{{ resource_provider_namespace }}' --required
AND parent_resource_path = '{{ parent_resource_path }}' --required
AND resource_type = '{{ resource_type }}' --required
AND resource_name = '{{ resource_name }}' --required
AND lock_name = '{{ lock_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
;