Skip to main content

role_definitions

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

Overview​

Namerole_definitions
TypeResource
Idazure.authorization.role_definitions

Fields​

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringFully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
namestringThe name of the resource.
assignableScopesarrayRole definition assignable scopes.
createdBystringId of the user who created the assignment.
createdOnstring (date-time)Time it was created.
descriptionstringThe role definition description.
permissionsarrayRole definition permissions.
roleNamestringThe role name.
systemDataobjectAzure Resource Manager metadata containing createdBy and modifiedBy information.
typestringThe type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts".
updatedBystringId of the user who updated the assignment.
updatedOnstring (date-time)Time it was updated.

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectscope, role_definition_idGet role definition by ID (GUID).
listselectscope$filterGet all role definitions that are applicable at scope and above.
get_by_idselectrole_idGets a role definition by ID.
create_or_updateinsertscope, role_definition_idCreates or updates a role definition.
create_or_updatereplacescope, role_definition_idCreates or updates a role definition.
deletedeletescope, role_definition_idDeletes a role definition.

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
role_definition_idstringThe ID of the role definition. Required.
role_idstringThe fully qualified role definition ID. Use the format, /subscriptions/{guid}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for subscription level role definitions, or /providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for tenant level role definitions. Required.
scopestringThe fully qualified Azure Resource manager identifier of the resource. Required.
$filterstringThe filter to apply on the operation. Use atScopeAndBelow filter to search below the given scope as well. Default value is None.

SELECT examples​

Get role definition by ID (GUID).

SELECT
id,
name,
assignableScopes,
createdBy,
createdOn,
description,
permissions,
roleName,
systemData,
type,
updatedBy,
updatedOn
FROM azure.authorization.role_definitions
WHERE scope = '{{ scope }}' -- required
AND role_definition_id = '{{ role_definition_id }}' -- required
;

INSERT examples​

Creates or updates a role definition.

INSERT INTO azure.authorization.role_definitions (
properties,
scope,
role_definition_id
)
SELECT
'{{ properties }}',
'{{ scope }}',
'{{ role_definition_id }}'
RETURNING
id,
name,
properties,
systemData,
type
;

REPLACE examples​

Creates or updates a role definition.

REPLACE azure.authorization.role_definitions
SET
properties = '{{ properties }}'
WHERE
scope = '{{ scope }}' --required
AND role_definition_id = '{{ role_definition_id }}' --required
RETURNING
id,
name,
properties,
systemData,
type;

DELETE examples​

Deletes a role definition.

DELETE FROM azure.authorization.role_definitions
WHERE scope = '{{ scope }}' --required
AND role_definition_id = '{{ role_definition_id }}' --required
;