PolicyEnrollmentsOperations Class

Warning

DO NOT instantiate this class directly.

Instead, you should access the following operations through

PolicyClient's

<xref:policy_enrollments> attribute.

Constructor

PolicyEnrollmentsOperations(*args, **kwargs)

Methods

create_or_update

Creates or updates a policy enrollment.

This operation creates or updates a policy enrollment with the given scope and name. Policy enrollments apply to all resources contained within their scope. For example, when you create a policy enrollment at resource group scope for a policy assignment at the same or above level, the enrollment applies to all applicable resources in the resource group.

delete

Deletes a policy enrollment.

This operation deletes a policy enrollment, given its name and the scope it was created in. The scope of a policy enrollment is the part of its ID preceding '/providers/Microsoft.Authorization/policyEnrollments/{policyEnrollmentName}'.

get

Retrieves a policy enrollment.

This operation retrieves a single policy enrollment, given its name and the scope it was created at.

list

Retrieves all policy enrollments that apply to a subscription.

This operation retrieves the list of all policy enrollments associated with the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'atExactScope()'. If $filter is not provided, the unfiltered list includes all policy enrollments associated with the subscription, including those that apply directly or from management groups that contain the given subscription, as well as any applied to objects contained within the subscription.

list_for_management_group

Retrieves all policy enrollments that apply to a management group.

This operation retrieves the list of all policy enrollments applicable to the management group that match the given $filter. Valid values for $filter are: 'atScope()' or 'atExactScope()'. If $filter=atScope() is provided, the returned list includes all policy enrollments that are assigned to the management group or the management group's ancestors.

list_for_resource

Retrieves all policy enrollments that apply to a resource.

This operation retrieves the list of all policy enrollments associated with the specified resource in the given resource group and subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'atExactScope()'. If $filter is not provided, the unfiltered list includes all policy enrollments associated with the resource, including those that apply directly or from all containing scopes, as well as any applied to resources contained within the resource. Three parameters plus the resource name are used to identify a specific resource. If the resource is not part of a parent resource (the more common case), the parent resource path should not be provided (or provided as ''). For example a web app could be specified as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent resource, then all parameters should be provided. For example a virtual machine DNS name could be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == 'MyComputerName'). A convenient alternative to providing the namespace and type name separately is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp').

list_for_resource_group

Retrieves all policy enrollments that apply to a resource group.

This operation retrieves the list of all policy enrollments associated with the given resource group in the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'atExactScope()'. If $filter is not provided, the unfiltered list includes all policy enrollments associated with the resource group, including those that apply directly or apply from containing scopes, as well as any applied to resources contained within the resource group.

update

Updates a policy enrollment.

This operation updates a policy enrollment with the given scope and name.

create_or_update

Creates or updates a policy enrollment.

This operation creates or updates a policy enrollment with the given scope and name. Policy enrollments apply to all resources contained within their scope. For example, when you create a policy enrollment at resource group scope for a policy assignment at the same or above level, the enrollment applies to all applicable resources in the resource group.

async create_or_update(scope: str, policy_enrollment_name: str, parameters: _models.PolicyEnrollment, *, content_type: str = 'application/json', **kwargs: Any) -> _models.PolicyEnrollment

Parameters

Name Description
scope
Required
str

The fully qualified Azure Resource manager identifier of the resource. Required.

policy_enrollment_name
Required
str

The name of the policy enrollment. Required.

parameters
Required
PolicyEnrollment or <xref:JSON> or IO[bytes]

The policy enrollment resource to create or replace. Is one of the following types: PolicyEnrollment, JSON, IO[bytes] Required.

Returns

Type Description

PolicyEnrollment. The PolicyEnrollment is compatible with MutableMapping

Exceptions

Type Description

delete

Deletes a policy enrollment.

This operation deletes a policy enrollment, given its name and the scope it was created in. The scope of a policy enrollment is the part of its ID preceding '/providers/Microsoft.Authorization/policyEnrollments/{policyEnrollmentName}'.

async delete(scope: str, policy_enrollment_name: str, **kwargs: Any) -> None

Parameters

Name Description
scope
Required
str

The fully qualified Azure Resource manager identifier of the resource. Required.

policy_enrollment_name
Required
str

The name of the policy enrollment. Required.

Returns

Type Description

None

Exceptions

Type Description

get

Retrieves a policy enrollment.

This operation retrieves a single policy enrollment, given its name and the scope it was created at.

async get(scope: str, policy_enrollment_name: str, **kwargs: Any) -> PolicyEnrollment

Parameters

Name Description
scope
Required
str

The fully qualified Azure Resource manager identifier of the resource. Required.

policy_enrollment_name
Required
str

The name of the policy enrollment. Required.

Returns

Type Description

PolicyEnrollment. The PolicyEnrollment is compatible with MutableMapping

Exceptions

Type Description

list

Retrieves all policy enrollments that apply to a subscription.

This operation retrieves the list of all policy enrollments associated with the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'atExactScope()'. If $filter is not provided, the unfiltered list includes all policy enrollments associated with the subscription, including those that apply directly or from management groups that contain the given subscription, as well as any applied to objects contained within the subscription.

list(*, filter: str | None = None, **kwargs: Any) -> AsyncItemPaged[PolicyEnrollment]

Keyword-Only Parameters

Name Description
filter
str

The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'atExactScope()'. If $filter is not provided, no filtering is performed. If $filter is not provided, the unfiltered list includes all policy enrollments associated with the scope, including those that apply directly or from containing scopes. If $filter=atScope() is provided, the returned list includes all policy enrollments that apply to the scope, which is everything in the unfiltered list except those applied to sub-scopes contained within the given scope. If $filter=atExactScope() is provided, the returned list only includes all policy enrollments that apply at the given scope. Default value is None.

Default value: None

Returns

Type Description

An iterator like instance of PolicyEnrollment

Exceptions

Type Description

list_for_management_group

Retrieves all policy enrollments that apply to a management group.

This operation retrieves the list of all policy enrollments applicable to the management group that match the given $filter. Valid values for $filter are: 'atScope()' or 'atExactScope()'. If $filter=atScope() is provided, the returned list includes all policy enrollments that are assigned to the management group or the management group's ancestors.

list_for_management_group(management_group_id: str, *, filter: str | None = None, **kwargs: Any) -> AsyncItemPaged[PolicyEnrollment]

Parameters

Name Description
management_group_id
Required
str

The management group ID. Required.

Keyword-Only Parameters

Name Description
filter
str

The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'atExactScope()'. If $filter is not provided, no filtering is performed. If $filter is not provided, the unfiltered list includes all policy enrollments associated with the scope, including those that apply directly or from containing scopes. If $filter=atScope() is provided, the returned list includes all policy enrollments that apply to the scope, which is everything in the unfiltered list except those applied to sub-scopes contained within the given scope. If $filter=atExactScope() is provided, the returned list only includes all policy enrollments that apply at the given scope. Default value is None.

Default value: None

Returns

Type Description

An iterator like instance of PolicyEnrollment

Exceptions

Type Description

list_for_resource

Retrieves all policy enrollments that apply to a resource.

This operation retrieves the list of all policy enrollments associated with the specified resource in the given resource group and subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'atExactScope()'. If $filter is not provided, the unfiltered list includes all policy enrollments associated with the resource, including those that apply directly or from all containing scopes, as well as any applied to resources contained within the resource. Three parameters plus the resource name are used to identify a specific resource. If the resource is not part of a parent resource (the more common case), the parent resource path should not be provided (or provided as ''). For example a web app could be specified as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent resource, then all parameters should be provided. For example a virtual machine DNS name could be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == 'MyComputerName'). A convenient alternative to providing the namespace and type name separately is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp').

list_for_resource(resource_group_name: str, resource_provider_namespace: str, parent_resource_path: str, resource_type: str, resource_name: str, *, filter: str | None = None, **kwargs: Any) -> AsyncItemPaged[PolicyEnrollment]

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. For example, the namespace of a virtual machine is Microsoft.Compute (from Microsoft.Compute/virtualMachines). Required.

parent_resource_path
Required
str

The parent resource path. Use empty string if there is none. 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 name of the resource. Required.

Keyword-Only Parameters

Name Description
filter
str

The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'atExactScope()'. If $filter is not provided, no filtering is performed. If $filter is not provided, the unfiltered list includes all policy enrollments associated with the scope, including those that apply directly or from containing scopes. If $filter=atScope() is provided, the returned list includes all policy enrollments that apply to the scope, which is everything in the unfiltered list except those applied to sub-scopes contained within the given scope. If $filter=atExactScope() is provided, the returned list only includes all policy enrollments that apply at the given scope. Default value is None.

Default value: None

Returns

Type Description

An iterator like instance of PolicyEnrollment

Exceptions

Type Description

list_for_resource_group

Retrieves all policy enrollments that apply to a resource group.

This operation retrieves the list of all policy enrollments associated with the given resource group in the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'atExactScope()'. If $filter is not provided, the unfiltered list includes all policy enrollments associated with the resource group, including those that apply directly or apply from containing scopes, as well as any applied to resources contained within the resource group.

list_for_resource_group(resource_group_name: str, *, filter: str | None = None, **kwargs: Any) -> AsyncItemPaged[PolicyEnrollment]

Parameters

Name Description
resource_group_name
Required
str

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

Keyword-Only Parameters

Name Description
filter
str

The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'atExactScope()'. If $filter is not provided, no filtering is performed. If $filter is not provided, the unfiltered list includes all policy enrollments associated with the scope, including those that apply directly or from containing scopes. If $filter=atScope() is provided, the returned list includes all policy enrollments that apply to the scope, which is everything in the unfiltered list except those applied to sub-scopes contained within the given scope. If $filter=atExactScope() is provided, the returned list only includes all policy enrollments that apply at the given scope. Default value is None.

Default value: None

Returns

Type Description

An iterator like instance of PolicyEnrollment

Exceptions

Type Description

update

Updates a policy enrollment.

This operation updates a policy enrollment with the given scope and name.

async update(scope: str, policy_enrollment_name: str, parameters: _models.PolicyEnrollmentUpdate, *, content_type: str = 'application/json', **kwargs: Any) -> _models.PolicyEnrollment

Parameters

Name Description
scope
Required
str

The fully qualified Azure Resource manager identifier of the resource. Required.

policy_enrollment_name
Required
str

The name of the policy enrollment. Required.

parameters
Required
PolicyEnrollmentUpdate or <xref:JSON> or IO[bytes]

The properties to update in the policy enrollment. Is one of the following types: PolicyEnrollmentUpdate, JSON, IO[bytes] Required.

Returns

Type Description

PolicyEnrollment. The PolicyEnrollment is compatible with MutableMapping

Exceptions

Type Description