PolicyAssignmentsOperations Class

PolicyAssignmentsOperations async 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
PolicyAssignmentsOperations

Constructor

PolicyAssignmentsOperations(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

Creates a policy assignment.

Policy assignments are inherited by child resources. For example, when you apply a policy to a resource group that policy is assigned to all resources in the group.

create_by_id

Creates a policy assignment by ID.

Policy assignments are inherited by child resources. For example, when you apply a policy to a resource group that policy is assigned to all resources in the group. When providing a scope for the assignment, use '/subscriptions/{subscription-id}/' for subscriptions, '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for resource groups, and '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}' for resources.

delete

Deletes a policy assignment.

delete_by_id

Deletes a policy assignment by ID.

When providing a scope for the assignment, use '/subscriptions/{subscription-id}/' for subscriptions, '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for resource groups, and '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}' for resources.

get

Gets a policy assignment.

get_by_id

Gets a policy assignment by ID.

When providing a scope for the assignment, use '/subscriptions/{subscription-id}/' for subscriptions, '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for resource groups, and '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}' for resources.

list

Gets all the policy assignments for a subscription.

list_for_resource

Gets policy assignments for a resource.

list_for_resource_group

Gets policy assignments for the resource group.

create

Creates a policy assignment.

Policy assignments are inherited by child resources. For example, when you apply a policy to a resource group that policy is assigned to all resources in the group.

async create(scope: str, policy_assignment_name: str, parameters: azure.mgmt.resource.policy.v2016_04_01.models._models_py3.PolicyAssignment, *, content_type: Optional[str] = 'application/json', **kwargs: Any) -> azure.mgmt.resource.policy.v2016_04_01.models._models_py3.PolicyAssignment

Parameters

scope
str
Required

The scope of the policy assignment.

policy_assignment_name
str
Required

The name of the policy assignment.

parameters
PolicyAssignment
Required

Parameters for the policy assignment.

content_type
str

Media type of the body sent to the API. Possible values are: "application/json" or "text/json". Default value is "application/json".

cls
callable

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

Returns

PolicyAssignment, or the result of cls(response)

Return type

Exceptions

create_by_id

Creates a policy assignment by ID.

Policy assignments are inherited by child resources. For example, when you apply a policy to a resource group that policy is assigned to all resources in the group. When providing a scope for the assignment, use '/subscriptions/{subscription-id}/' for subscriptions, '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for resource groups, and '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}' for resources.

async create_by_id(policy_assignment_id: str, parameters: azure.mgmt.resource.policy.v2016_04_01.models._models_py3.PolicyAssignment, *, content_type: Optional[str] = 'application/json', **kwargs: Any) -> azure.mgmt.resource.policy.v2016_04_01.models._models_py3.PolicyAssignment

Parameters

policy_assignment_id
str
Required

The ID of the policy assignment to create. Use the format '/{scope}/providers/Microsoft.Authorization/policyAssignments/{policy-assignment-name}'.

parameters
PolicyAssignment
Required

Parameters for policy assignment.

content_type
str

Media type of the body sent to the API. Possible values are: "application/json" or "text/json". Default value is "application/json".

cls
callable

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

Returns

PolicyAssignment, or the result of cls(response)

Return type

Exceptions

delete

Deletes a policy assignment.

async delete(scope: str, policy_assignment_name: str, **kwargs: Any) -> azure.mgmt.resource.policy.v2016_04_01.models._models_py3.PolicyAssignment

Parameters

scope
str
Required

The scope of the policy assignment.

policy_assignment_name
str
Required

The name of the policy assignment to delete.

cls
callable

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

Returns

PolicyAssignment, or the result of cls(response)

Return type

Exceptions

delete_by_id

Deletes a policy assignment by ID.

When providing a scope for the assignment, use '/subscriptions/{subscription-id}/' for subscriptions, '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for resource groups, and '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}' for resources.

async delete_by_id(policy_assignment_id: str, **kwargs: Any) -> azure.mgmt.resource.policy.v2016_04_01.models._models_py3.PolicyAssignment

Parameters

policy_assignment_id
str
Required

The ID of the policy assignment to delete. Use the format '/{scope}/providers/Microsoft.Authorization/policyAssignments/{policy-assignment-name}'.

cls
callable

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

Returns

PolicyAssignment, or the result of cls(response)

Return type

Exceptions

get

Gets a policy assignment.

async get(scope: str, policy_assignment_name: str, **kwargs: Any) -> azure.mgmt.resource.policy.v2016_04_01.models._models_py3.PolicyAssignment

Parameters

scope
str
Required

The scope of the policy assignment.

policy_assignment_name
str
Required

The name of the policy assignment to get.

cls
callable

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

Returns

PolicyAssignment, or the result of cls(response)

Return type

Exceptions

get_by_id

Gets a policy assignment by ID.

When providing a scope for the assignment, use '/subscriptions/{subscription-id}/' for subscriptions, '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for resource groups, and '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}' for resources.

async get_by_id(policy_assignment_id: str, **kwargs: Any) -> azure.mgmt.resource.policy.v2016_04_01.models._models_py3.PolicyAssignment

Parameters

policy_assignment_id
str
Required

The ID of the policy assignment to get. Use the format '/{scope}/providers/Microsoft.Authorization/policyAssignments/{policy-assignment-name}'.

cls
callable

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

Returns

PolicyAssignment, or the result of cls(response)

Return type

Exceptions

list

Gets all the policy assignments for a subscription.

list(filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable[azure.mgmt.resource.policy.v2016_04_01.models._models_py3.PolicyAssignmentListResult]

Parameters

filter
str
Required

The filter to apply on the operation. Default value is None.

cls
callable

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

Returns

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

Return type

Exceptions

list_for_resource

Gets policy 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: Optional[str] = None, **kwargs: Any) -> AsyncIterable[azure.mgmt.resource.policy.v2016_04_01.models._models_py3.PolicyAssignmentListResult]

Parameters

resource_group_name
str
Required

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

resource_provider_namespace
str
Required

The namespace of the resource provider.

parent_resource_path
str
Required

The parent resource path.

resource_type
str
Required

The resource type.

resource_name
str
Required

The name of the resource with policy assignments.

filter
str
Required

The filter to apply on the operation. Default value is None.

cls
callable

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

Returns

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

Return type

Exceptions

list_for_resource_group

Gets policy assignments for the resource group.

list_for_resource_group(resource_group_name: str, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable[azure.mgmt.resource.policy.v2016_04_01.models._models_py3.PolicyAssignmentListResult]

Parameters

resource_group_name
str
Required

The name of the resource group that contains policy assignments.

filter
str
Required

The filter to apply on the operation. Default value is None.

cls
callable

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

Returns

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

Return type

Exceptions

Attributes

models

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