RoleAssignmentsOperations Class

Warning

DO NOT instantiate this class directly.

Instead, you should access the following operations through

AuthorizationManagementClient's

<xref:role_assignments> attribute.

Inheritance
builtins.object
RoleAssignmentsOperations

Constructor

RoleAssignmentsOperations(*args, **kwargs)

Methods

create

Creates a role assignment.

create_by_id

Creates a role assignment by ID.

delete

Deletes a role assignment.

delete_by_id

Deletes a role assignment.

get

Get the specified role assignment.

get_by_id

Gets a role assignment by ID.

list

Gets all role assignments for the subscription.

list_for_resource

Gets role assignments for a resource.

list_for_resource_group

Gets role assignments for a resource group.

list_for_scope

Gets role assignments for a scope.

create

Creates a role assignment.

create(scope: str, role_assignment_name: str, parameters: _models.RoleAssignmentCreateParameters, *, content_type: str = 'application/json', **kwargs: Any) -> _models.RoleAssignment

Parameters

Name Description
scope
Required
str

The scope of the role assignment to create. The scope can be any REST resource instance. For example, use '/subscriptions/{subscription-id}/' for a subscription, '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for a resource group, and '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' for a resource. Required.

role_assignment_name
Required
str

A GUID for the role assignment to create. The name must be unique and different for each role assignment. Required.

parameters
Required

Parameters for the role assignment. Is either a RoleAssignmentCreateParameters type or a IO type. Required.

Keyword-Only Parameters

Name Description
content_type
str

Body Parameter content-type. Known values are: 'application/json'. Default value is None.

cls

A custom type or function that will be passed the direct response

Returns

Type Description

RoleAssignment or the result of cls(response)

Exceptions

Type Description

create_by_id

Creates a role assignment by ID.

create_by_id(role_assignment_id: str, parameters: _models.RoleAssignmentCreateParameters, *, content_type: str = 'application/json', **kwargs: Any) -> _models.RoleAssignment

Parameters

Name Description
role_assignment_id
Required
str

The fully qualified ID of the role assignment, including the scope, resource name and resource type. Use the format, /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example: /subscriptions/{subId}/resourcegroups/{rgname}//providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Required.

parameters
Required

Parameters for the role assignment. Is either a RoleAssignmentCreateParameters type or a IO type. Required.

Keyword-Only Parameters

Name Description
content_type
str

Body Parameter content-type. Known values are: 'application/json'. Default value is None.

cls

A custom type or function that will be passed the direct response

Returns

Type Description

RoleAssignment or the result of cls(response)

Exceptions

Type Description

delete

Deletes a role assignment.

delete(scope: str, role_assignment_name: str, **kwargs: Any) -> RoleAssignment | None

Parameters

Name Description
scope
Required
str

The scope of the role assignment to delete. Required.

role_assignment_name
Required
str

The name of the role assignment to delete. Required.

Keyword-Only Parameters

Name Description
cls

A custom type or function that will be passed the direct response

Returns

Type Description

RoleAssignment or None or the result of cls(response)

Exceptions

Type Description

delete_by_id

Deletes a role assignment.

delete_by_id(role_assignment_id: str, **kwargs: Any) -> RoleAssignment | None

Parameters

Name Description
role_assignment_id
Required
str

The fully qualified ID of the role assignment, including the scope, resource name and resource type. Use the format, /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example: /subscriptions/{subId}/resourcegroups/{rgname}//providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Required.

Keyword-Only Parameters

Name Description
cls

A custom type or function that will be passed the direct response

Returns

Type Description

RoleAssignment or None or the result of cls(response)

Exceptions

Type Description

get

Get the specified role assignment.

get(scope: str, role_assignment_name: str, **kwargs: Any) -> RoleAssignment

Parameters

Name Description
scope
Required
str

The scope of the role assignment. Required.

role_assignment_name
Required
str

The name of the role assignment to get. Required.

Keyword-Only Parameters

Name Description
cls

A custom type or function that will be passed the direct response

Returns

Type Description

RoleAssignment or the result of cls(response)

Exceptions

Type Description

get_by_id

Gets a role assignment by ID.

get_by_id(role_assignment_id: str, **kwargs: Any) -> RoleAssignment

Parameters

Name Description
role_assignment_id
Required
str

The fully qualified ID of the role assignment, including the scope, resource name and resource type. Use the format, /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example: /subscriptions/{subId}/resourcegroups/{rgname}//providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Required.

Keyword-Only Parameters

Name Description
cls

A custom type or function that will be passed the direct response

Returns

Type Description

RoleAssignment or the result of cls(response)

Exceptions

Type Description

list

Gets all role assignments for the subscription.

list(filter: str | None = None, **kwargs: Any) -> Iterable[RoleAssignment]

Parameters

Name Description
filter
Required
str

The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. Default value is None.

Keyword-Only Parameters

Name Description
cls

A custom type or function that will be passed the direct response

Returns

Type Description

An iterator like instance of either RoleAssignment or the result of cls(response)

Exceptions

Type Description

list_for_resource

Gets role assignments for a resource.

list_for_resource(resource_group_name: str, resource_provider_namespace: str, parent_resource_path: str, resource_type: str, resource_name: str, filter: str | None = None, **kwargs: Any) -> Iterable[RoleAssignment]

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group. The name is case insensitive. Required.

resource_provider_namespace
Required
str

The namespace of the resource provider. Required.

parent_resource_path
Required
str

The parent resource identity. Required.

resource_type
Required
str

The resource type of the resource. Required.

resource_name
Required
str

The name of the resource to get role assignments for. Required.

filter
Required
str

The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. Default value is None.

Keyword-Only Parameters

Name Description
cls

A custom type or function that will be passed the direct response

Returns

Type Description

An iterator like instance of either RoleAssignment or the result of cls(response)

Exceptions

Type Description

list_for_resource_group

Gets role assignments for a resource group.

list_for_resource_group(resource_group_name: str, filter: str | None = None, **kwargs: Any) -> Iterable[RoleAssignment]

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group. The name is case insensitive. Required.

filter
Required
str

The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. Default value is None.

Keyword-Only Parameters

Name Description
cls

A custom type or function that will be passed the direct response

Returns

Type Description

An iterator like instance of either RoleAssignment or the result of cls(response)

Exceptions

Type Description

list_for_scope

Gets role assignments for a scope.

list_for_scope(scope: str, filter: str | None = None, **kwargs: Any) -> Iterable[RoleAssignment]

Parameters

Name Description
scope
Required
str

The scope of the role assignments. Required.

filter
Required
str

The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. Default value is None.

Keyword-Only Parameters

Name Description
cls

A custom type or function that will be passed the direct response

Returns

Type Description

An iterator like instance of either RoleAssignment or the result of cls(response)

Exceptions

Type Description

Attributes

models

models = <module 'azure.mgmt.authorization.v2015_07_01.models' from 'C:\\hostedtoolcache\\windows\\Python\\3.11.9\\x64\\Lib\\site-packages\\azure\\mgmt\\authorization\\v2015_07_01\\models\\__init__.py'>