Compartilhar via


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

Create or update a role assignment by scope and name.

create_by_id

Create or update a role assignment by ID.

delete

Delete a role assignment by scope and name.

delete_by_id

Delete a role assignment by ID.

get

Get a role assignment by scope and name.

get_by_id

Get a role assignment by ID.

list_for_resource

List all role assignments that apply to a resource.

list_for_resource_group

List all role assignments that apply to a resource group.

list_for_scope

List all role assignments that apply to a scope.

list_for_subscription

List all role assignments that apply to a subscription.

validate

Validate a role assignment create or update operation by scope and name.

validate_by_id

Validate a role assignment create or update operation by ID.

create

Create or update a role assignment by scope and name.

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 operation or resource. Valid scopes are: subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. Required.

role_assignment_name
Required
str

The name of the role assignment. It can be any valid GUID. 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

Create or update 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 scope, resource name, and resource type. Format: /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example: /subscriptions/<SUB_ID>/resourcegroups/<RESOURCE_GROUP>/providers/Microsoft.Authorization/roleAssignments/<ROLE_ASSIGNMENT_NAME>. 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

Delete a role assignment by scope and name.

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

Parameters

Name Description
scope
Required
str

The scope of the operation or resource. Valid scopes are: subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. Required.

role_assignment_name
Required
str

The name of the role assignment. It can be any valid GUID. Required.

tenant_id
Required
str

Tenant ID for cross-tenant request. 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

RoleAssignment or None or the result of cls(response)

Exceptions

Type Description

delete_by_id

Delete a role assignment by ID.

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

Parameters

Name Description
role_assignment_id
Required
str

The fully qualified ID of the role assignment including scope, resource name, and resource type. Format: /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example: /subscriptions/<SUB_ID>/resourcegroups/<RESOURCE_GROUP>/providers/Microsoft.Authorization/roleAssignments/<ROLE_ASSIGNMENT_NAME>. Required.

tenant_id
Required
str

Tenant ID for cross-tenant request. 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

RoleAssignment or None or the result of cls(response)

Exceptions

Type Description

get

Get a role assignment by scope and name.

get(scope: str, role_assignment_name: str, tenant_id: str | None = None, **kwargs: Any) -> RoleAssignment

Parameters

Name Description
scope
Required
str

The scope of the operation or resource. Valid scopes are: subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. Required.

role_assignment_name
Required
str

The name of the role assignment. It can be any valid GUID. Required.

tenant_id
Required
str

Tenant ID for cross-tenant request. 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

RoleAssignment or the result of cls(response)

Exceptions

Type Description

get_by_id

Get a role assignment by ID.

get_by_id(role_assignment_id: str, tenant_id: str | None = None, **kwargs: Any) -> RoleAssignment

Parameters

Name Description
role_assignment_id
Required
str

The fully qualified ID of the role assignment including scope, resource name, and resource type. Format: /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example: /subscriptions/<SUB_ID>/resourcegroups/<RESOURCE_GROUP>/providers/Microsoft.Authorization/roleAssignments/<ROLE_ASSIGNMENT_NAME>. Required.

tenant_id
Required
str

Tenant ID for cross-tenant request. 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

RoleAssignment or the result of cls(response)

Exceptions

Type Description

list_for_resource

List all role assignments that apply to a resource.

list_for_resource(resource_group_name: str, resource_provider_namespace: str, resource_type: str, resource_name: str, filter: str | None = None, tenant_id: 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.

resource_type
Required
str

The resource type name. For example the type name of a web app is 'sites' (from Microsoft.Web/sites). Required.

resource_name
Required
str

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

tenant_id
Required
str

Tenant ID for cross-tenant request. 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

List all role assignments that apply to a resource group.

list_for_resource_group(resource_group_name: str, filter: str | None = None, tenant_id: 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.

tenant_id
Required
str

Tenant ID for cross-tenant request. 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

List all role assignments that apply to a scope.

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

Parameters

Name Description
scope
Required
str

The scope of the operation or resource. Valid scopes are: subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. 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.

tenant_id
Required
str

Tenant ID for cross-tenant request. 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_subscription

List all role assignments that apply to a subscription.

list_for_subscription(filter: str | None = None, tenant_id: 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.

tenant_id
Required
str

Tenant ID for cross-tenant request. 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

validate

Validate a role assignment create or update operation by scope and name.

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

Parameters

Name Description
scope
Required
str

The scope of the operation or resource. Valid scopes are: subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. Required.

role_assignment_name
Required
str

The name of the role assignment. It can be any valid GUID. 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

ValidationResponse or the result of cls(response)

Exceptions

Type Description

validate_by_id

Validate a role assignment create or update operation by ID.

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

Parameters

Name Description
role_assignment_id
Required
str

The fully qualified ID of the role assignment including scope, resource name, and resource type. Format: /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example: /subscriptions/<SUB_ID>/resourcegroups/<RESOURCE_GROUP>/providers/Microsoft.Authorization/roleAssignments/<ROLE_ASSIGNMENT_NAME>. 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

ValidationResponse or the result of cls(response)

Exceptions

Type Description

Attributes

models

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