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.objectRoleAssignmentsOperations
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. |
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
|
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
|
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
|
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
|
The fully qualified ID of the role assignment including scope,
resource name, and resource type. Format:
/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example:
/subscriptions/ |
parameters
Required
|
Parameters for the role assignment. Is either a RoleAssignmentCreateParameters type or a IO type. Required. |
Keyword-Only Parameters
Name | Description |
---|---|
content_type
|
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
|
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
|
The name of the role assignment. It can be any valid GUID. Required. |
tenant_id
Required
|
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
|
The fully qualified ID of the role assignment including scope,
resource name, and resource type. Format:
/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example:
/subscriptions/ |
tenant_id
Required
|
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
|
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
|
The name of the role assignment. It can be any valid GUID. Required. |
tenant_id
Required
|
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
|
The fully qualified ID of the role assignment including scope,
resource name, and resource type. Format:
/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example:
/subscriptions/ |
tenant_id
Required
|
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
|
The name of the resource group. The name is case insensitive. Required. |
resource_provider_namespace
Required
|
The namespace of the resource provider. Required. |
resource_type
Required
|
The resource type name. For example the type name of a web app is 'sites' (from Microsoft.Web/sites). Required. |
resource_name
Required
|
The resource name. Required. |
filter
Required
|
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
|
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
|
The name of the resource group. The name is case insensitive. Required. |
filter
Required
|
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
|
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, skip_token: str | None = None, **kwargs: Any) -> Iterable[RoleAssignment]
Parameters
Name | Description |
---|---|
scope
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}'. Required. |
filter
Required
|
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
|
Tenant ID for cross-tenant request. Default value is None. |
skip_token
Required
|
The skipToken to apply on the operation. Use $skipToken={skiptoken} to return paged role assignments following the skipToken passed. Only supported on provider level calls. 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
|
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
|
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 |
---|---|
Attributes
models
models = <module 'azure.mgmt.authorization.v2022_04_01.models' from 'C:\\hostedtoolcache\\windows\\Python\\3.11.9\\x64\\Lib\\site-packages\\azure\\mgmt\\authorization\\v2022_04_01\\models\\__init__.py'>
Azure SDK for Python