RoleAssignmentsOperations Class

RoleAssignmentsOperations operations.

You should not instantiate this class directly. Instead, you should create a Client instance that instantiates it for you and attaches it as an attribute.

Inheritance
builtins.object
RoleAssignmentsOperations

Constructor

RoleAssignmentsOperations(client, config, serializer, deserializer)

Parameters

client
Required

Client for service requests.

config
Required

Configuration of service client.

serializer
Required

An object model serializer.

deserializer
Required

An object model deserializer.

Variables

models

Alias to model classes used in this operation group.

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, **kwargs: Any) -> _models.RoleAssignment

Parameters

scope
str
Required

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}'.

role_assignment_name
str
Required

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

parameters
RoleAssignmentCreateParameters
Required

Parameters for the role assignment.

cls
callable

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

Returns

RoleAssignment, or the result of cls(response)

Return type

Exceptions

create_by_id

Create or update a role assignment by ID.

create_by_id(role_assignment_id: str, parameters: _models.RoleAssignmentCreateParameters, **kwargs: Any) -> _models.RoleAssignment

Parameters

role_assignment_id
str
Required

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>.

parameters
RoleAssignmentCreateParameters
Required

Parameters for the role assignment.

cls
callable

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

Returns

RoleAssignment, or the result of cls(response)

Return type

Exceptions

delete

Delete a role assignment by scope and name.

delete(scope: str, role_assignment_name: str, tenant_id: Optional[str] = None, **kwargs: Any) -> Optional[_models.RoleAssignment]

Parameters

scope
str
Required

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}'.

role_assignment_name
str
Required

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

tenant_id
str
default value: None

Tenant ID for cross-tenant request.

cls
callable

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

Returns

RoleAssignment, or the result of cls(response)

Return type

Exceptions

delete_by_id

Delete a role assignment by ID.

delete_by_id(role_assignment_id: str, tenant_id: Optional[str] = None, **kwargs: Any) -> Optional[_models.RoleAssignment]

Parameters

role_assignment_id
str
Required

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>.

tenant_id
str
default value: None

Tenant ID for cross-tenant request.

cls
callable

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

Returns

RoleAssignment, or the result of cls(response)

Return type

Exceptions

get

Get a role assignment by scope and name.

get(scope: str, role_assignment_name: str, tenant_id: Optional[str] = None, **kwargs: Any) -> _models.RoleAssignment

Parameters

scope
str
Required

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}'.

role_assignment_name
str
Required

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

tenant_id
str
default value: None

Tenant ID for cross-tenant request.

cls
callable

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

Returns

RoleAssignment, or the result of cls(response)

Return type

Exceptions

get_by_id

Get a role assignment by ID.

get_by_id(role_assignment_id: str, tenant_id: Optional[str] = None, **kwargs: Any) -> _models.RoleAssignment

Parameters

role_assignment_id
str
Required

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>.

tenant_id
str
default value: None

Tenant ID for cross-tenant request.

cls
callable

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

Returns

RoleAssignment, or the result of cls(response)

Return type

Exceptions

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: Optional[str] = None, tenant_id: Optional[str] = None, **kwargs: Any) -> Iterable[_models.RoleAssignmentListResult]

Parameters

resource_group_name
str
Required

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

resource_provider_namespace
str
Required

The namespace of the resource provider.

resource_type
str
Required

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

resource_name
str
Required

The resource name.

filter
str
default value: None

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.

tenant_id
str
default value: None

Tenant ID for cross-tenant request.

cls
callable

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

Returns

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

Return type

Exceptions

list_for_resource_group

List all role assignments that apply to a resource group.

list_for_resource_group(resource_group_name: str, filter: Optional[str] = None, tenant_id: Optional[str] = None, **kwargs: Any) -> Iterable[_models.RoleAssignmentListResult]

Parameters

resource_group_name
str
Required

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

filter
str
default value: None

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.

tenant_id
str
default value: None

Tenant ID for cross-tenant request.

cls
callable

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

Returns

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

Return type

Exceptions

list_for_scope

List all role assignments that apply to a scope.

list_for_scope(scope: str, filter: Optional[str] = None, tenant_id: Optional[str] = None, **kwargs: Any) -> Iterable[_models.RoleAssignmentListResult]

Parameters

scope
str
Required

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}'.

filter
str
default value: None

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.

tenant_id
str
default value: None

Tenant ID for cross-tenant request.

cls
callable

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

Returns

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

Return type

Exceptions

list_for_subscription

List all role assignments that apply to a subscription.

list_for_subscription(filter: Optional[str] = None, tenant_id: Optional[str] = None, **kwargs: Any) -> Iterable[_models.RoleAssignmentListResult]

Parameters

filter
str
default value: None

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.

tenant_id
str
default value: None

Tenant ID for cross-tenant request.

cls
callable

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

Returns

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

Return type

Exceptions

validate

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

validate(scope: str, role_assignment_name: str, parameters: _models.RoleAssignmentCreateParameters, **kwargs: Any) -> _models.ValidationResponse

Parameters

scope
str
Required

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}'.

role_assignment_name
str
Required

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

parameters
RoleAssignmentCreateParameters
Required

Parameters for the role assignment.

cls
callable

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

Returns

ValidationResponse, or the result of cls(response)

Return type

Exceptions

validate_by_id

Validate a role assignment create or update operation by ID.

validate_by_id(role_assignment_id: str, parameters: _models.RoleAssignmentCreateParameters, **kwargs: Any) -> _models.ValidationResponse

Parameters

role_assignment_id
str
Required

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>.

parameters
RoleAssignmentCreateParameters
Required

Parameters for the role assignment.

cls
callable

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

Returns

ValidationResponse, or the result of cls(response)

Return type

Exceptions

Attributes

models

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