azure.mgmt.authorization.v2020_04_01_preview.operations module

class azure.mgmt.authorization.v2020_04_01_preview.operations.RoleAssignmentsOperations(*args, **kwargs)[source]

Bases: object

Warning

DO NOT instantiate this class directly.

Instead, you should access the following operations through AuthorizationManagementClient’s role_assignments attribute.

create(scope: str, role_assignment_name: str, parameters: _models.RoleAssignmentCreateParameters, *, content_type: str = "'application/json'", **kwargs: Any)_models.RoleAssignment[source]
create(scope: str, role_assignment_name: str, parameters: IO, *, content_type: str = "'application/json'", **kwargs: Any)_models.RoleAssignment

Create a role assignment.

Parameters
  • scope (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 (str) – A GUID for the role assignment to create. The name must be unique and different for each role assignment. Required.

  • parameters (RoleAssignmentCreateParameters or IO) – Parameters for the role assignment. Is either a RoleAssignmentCreateParameters type or a IO type. Required.

Keyword Arguments
  • content_type (str) – Body Parameter content-type. Known values are: ‘application/json’. Default value is None.

  • cls (callable) – A custom type or function that will be passed the direct response

Returns

RoleAssignment or the result of cls(response)

Return type

RoleAssignment

Raises

HttpResponseError

create_by_id(role_id: str, parameters: _models.RoleAssignmentCreateParameters, *, content_type: str = "'application/json'", **kwargs: Any)_models.RoleAssignment[source]
create_by_id(role_id: str, parameters: IO, *, content_type: str = "'application/json'", **kwargs: Any)_models.RoleAssignment

Creates a role assignment by ID.

Parameters
  • role_id (str) – The ID of the role assignment to create. Required.

  • parameters (RoleAssignmentCreateParameters or IO) – Parameters for the role assignment. Is either a RoleAssignmentCreateParameters type or a IO type. Required.

Keyword Arguments
  • content_type (str) – Body Parameter content-type. Known values are: ‘application/json’. Default value is None.

  • cls (callable) – A custom type or function that will be passed the direct response

Returns

RoleAssignment or the result of cls(response)

Return type

RoleAssignment

Raises

HttpResponseError

delete(scope: str, role_assignment_name: str, tenant_id: Optional[str] = None, **kwargs: Any)Optional[azure.mgmt.authorization.v2020_04_01_preview.models._models_py3.RoleAssignment][source]

Delete a role assignment.

Parameters
  • scope (str) – The scope of the role assignment to delete. Required.

  • role_assignment_name (str) – The name of the role assignment to delete. Required.

  • tenant_id (str) – Tenant ID for cross-tenant request. Default value is None.

Keyword Arguments

cls (callable) – A custom type or function that will be passed the direct response

Returns

RoleAssignment or None or the result of cls(response)

Return type

RoleAssignment or None

Raises

HttpResponseError

delete_by_id(role_id: str, tenant_id: Optional[str] = None, **kwargs: Any)Optional[azure.mgmt.authorization.v2020_04_01_preview.models._models_py3.RoleAssignment][source]

Delete a role assignment.

Parameters
  • role_id (str) – The ID of the role assignment to delete. Required.

  • tenant_id (str) – Tenant ID for cross-tenant request. Default value is None.

Keyword Arguments

cls (callable) – A custom type or function that will be passed the direct response

Returns

RoleAssignment or None or the result of cls(response)

Return type

RoleAssignment or None

Raises

HttpResponseError

get(scope: str, role_assignment_name: str, tenant_id: Optional[str] = None, **kwargs: Any)azure.mgmt.authorization.v2020_04_01_preview.models._models_py3.RoleAssignment[source]

Get the specified role assignment.

Parameters
  • scope (str) – The scope of the role assignment. Required.

  • role_assignment_name (str) – The name of the role assignment to get. Required.

  • tenant_id (str) – Tenant ID for cross-tenant request. Default value is None.

Keyword Arguments

cls (callable) – A custom type or function that will be passed the direct response

Returns

RoleAssignment or the result of cls(response)

Return type

RoleAssignment

Raises

HttpResponseError

get_by_id(role_id: str, tenant_id: Optional[str] = None, **kwargs: Any)azure.mgmt.authorization.v2020_04_01_preview.models._models_py3.RoleAssignment[source]

Gets a role assignment by ID.

Parameters
  • role_id (str) – The ID of the role assignment to get. Required.

  • tenant_id (str) – Tenant ID for cross-tenant request. Default value is None.

Keyword Arguments

cls (callable) – A custom type or function that will be passed the direct response

Returns

RoleAssignment or the result of cls(response)

Return type

RoleAssignment

Raises

HttpResponseError

list(filter: Optional[str] = None, tenant_id: Optional[str] = None, **kwargs: Any)Iterable[azure.mgmt.authorization.v2020_04_01_preview.models._models_py3.RoleAssignment][source]

Gets all role assignments for the subscription.

Parameters
  • filter (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 (str) – Tenant ID for cross-tenant request. Default value is None.

Keyword Arguments

cls (callable) – A custom type or function that will be passed the direct response

Returns

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

Return type

ItemPaged[RoleAssignment]

Raises

HttpResponseError

list_for_resource(resource_group_name: str, resource_provider_namespace: str, parent_resource_path: str, resource_type: str, resource_name: str, filter: Optional[str] = None, tenant_id: Optional[str] = None, **kwargs: Any)Iterable[azure.mgmt.authorization.v2020_04_01_preview.models._models_py3.RoleAssignment][source]

List role assignments for a resource.

Parameters
  • resource_group_name (str) – The name of the resource group. The name is case insensitive. Required.

  • resource_provider_namespace (str) – The namespace of the resource provider. Required.

  • parent_resource_path (str) – The parent resource identity. Required.

  • resource_type (str) – The resource type of the resource. Required.

  • resource_name (str) – The name of the resource to get role assignments for. Required.

  • filter (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 (str) – Tenant ID for cross-tenant request. Default value is None.

Keyword Arguments

cls (callable) – A custom type or function that will be passed the direct response

Returns

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

Return type

ItemPaged[RoleAssignment]

Raises

HttpResponseError

list_for_resource_group(resource_group_name: str, filter: Optional[str] = None, tenant_id: Optional[str] = None, **kwargs: Any)Iterable[azure.mgmt.authorization.v2020_04_01_preview.models._models_py3.RoleAssignment][source]

List role assignments for a resource group.

Parameters
  • resource_group_name (str) – The name of the resource group. The name is case insensitive. Required.

  • filter (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 (str) – Tenant ID for cross-tenant request. Default value is None.

Keyword Arguments

cls (callable) – A custom type or function that will be passed the direct response

Returns

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

Return type

ItemPaged[RoleAssignment]

Raises

HttpResponseError

list_for_scope(scope: str, filter: Optional[str] = None, tenant_id: Optional[str] = None, **kwargs: Any)Iterable[azure.mgmt.authorization.v2020_04_01_preview.models._models_py3.RoleAssignment][source]

Gets role assignments for a scope.

Parameters
  • scope (str) – The scope of the role assignments. Required.

  • filter (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 (str) – Tenant ID for cross-tenant request. Default value is None.

Keyword Arguments

cls (callable) – A custom type or function that will be passed the direct response

Returns

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

Return type

ItemPaged[RoleAssignment]

Raises

HttpResponseError

models = <module 'azure.mgmt.authorization.v2020_04_01_preview.models' from '/mnt/vss/_work/1/s/sdk/authorization/azure-mgmt-authorization/.tox/sphinx/lib/python3.9/site-packages/azure/mgmt/authorization/v2020_04_01_preview/models/__init__.py'>