PolicyAssignments interface

Interface representing a PolicyAssignments.

Methods

create(string, string, PolicyAssignment, PolicyAssignmentsCreateOptionalParams)

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.

createById(string, PolicyAssignment, PolicyAssignmentsCreateByIdOptionalParams)

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(string, string, PolicyAssignmentsDeleteOptionalParams)

Deletes a policy assignment.

deleteById(string, PolicyAssignmentsDeleteByIdOptionalParams)

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(string, string, PolicyAssignmentsGetOptionalParams)

Gets a policy assignment.

getById(string, PolicyAssignmentsGetByIdOptionalParams)

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(PolicyAssignmentsListOptionalParams)

Gets all the policy assignments for a subscription.

listForResource(string, string, string, string, string, PolicyAssignmentsListForResourceOptionalParams)

Gets policy assignments for a resource.

listForResourceGroup(string, PolicyAssignmentsListForResourceGroupOptionalParams)

Gets policy assignments for the resource group.

Method Details

create(string, string, PolicyAssignment, PolicyAssignmentsCreateOptionalParams)

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.

function create(scope: string, policyAssignmentName: string, parameters: PolicyAssignment, options?: PolicyAssignmentsCreateOptionalParams): Promise<PolicyAssignment>

Parameters

scope

string

The scope of the policy assignment.

policyAssignmentName

string

The name of the policy assignment.

parameters
PolicyAssignment

Parameters for the policy assignment.

options
PolicyAssignmentsCreateOptionalParams

The options parameters.

Returns

Promise<PolicyAssignment>

createById(string, PolicyAssignment, PolicyAssignmentsCreateByIdOptionalParams)

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.

function createById(policyAssignmentId: string, parameters: PolicyAssignment, options?: PolicyAssignmentsCreateByIdOptionalParams): Promise<PolicyAssignment>

Parameters

policyAssignmentId

string

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

parameters
PolicyAssignment

Parameters for policy assignment.

options
PolicyAssignmentsCreateByIdOptionalParams

The options parameters.

Returns

Promise<PolicyAssignment>

delete(string, string, PolicyAssignmentsDeleteOptionalParams)

Deletes a policy assignment.

function delete(scope: string, policyAssignmentName: string, options?: PolicyAssignmentsDeleteOptionalParams): Promise<PolicyAssignment>

Parameters

scope

string

The scope of the policy assignment.

policyAssignmentName

string

The name of the policy assignment to delete.

options
PolicyAssignmentsDeleteOptionalParams

The options parameters.

Returns

Promise<PolicyAssignment>

deleteById(string, PolicyAssignmentsDeleteByIdOptionalParams)

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.

function deleteById(policyAssignmentId: string, options?: PolicyAssignmentsDeleteByIdOptionalParams): Promise<PolicyAssignment>

Parameters

policyAssignmentId

string

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

options
PolicyAssignmentsDeleteByIdOptionalParams

The options parameters.

Returns

Promise<PolicyAssignment>

get(string, string, PolicyAssignmentsGetOptionalParams)

Gets a policy assignment.

function get(scope: string, policyAssignmentName: string, options?: PolicyAssignmentsGetOptionalParams): Promise<PolicyAssignment>

Parameters

scope

string

The scope of the policy assignment.

policyAssignmentName

string

The name of the policy assignment to get.

options
PolicyAssignmentsGetOptionalParams

The options parameters.

Returns

Promise<PolicyAssignment>

getById(string, PolicyAssignmentsGetByIdOptionalParams)

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.

function getById(policyAssignmentId: string, options?: PolicyAssignmentsGetByIdOptionalParams): Promise<PolicyAssignment>

Parameters

policyAssignmentId

string

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

options
PolicyAssignmentsGetByIdOptionalParams

The options parameters.

Returns

Promise<PolicyAssignment>

list(PolicyAssignmentsListOptionalParams)

Gets all the policy assignments for a subscription.

function list(options?: PolicyAssignmentsListOptionalParams): PagedAsyncIterableIterator<PolicyAssignment, PolicyAssignment[], PageSettings>

Parameters

options
PolicyAssignmentsListOptionalParams

The options parameters.

Returns

listForResource(string, string, string, string, string, PolicyAssignmentsListForResourceOptionalParams)

Gets policy assignments for a resource.

function listForResource(resourceGroupName: string, resourceProviderNamespace: string, parentResourcePath: string, resourceType: string, resourceName: string, options?: PolicyAssignmentsListForResourceOptionalParams): PagedAsyncIterableIterator<PolicyAssignment, PolicyAssignment[], PageSettings>

Parameters

resourceGroupName

string

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

resourceProviderNamespace

string

The namespace of the resource provider.

parentResourcePath

string

The parent resource path.

resourceType

string

The resource type.

resourceName

string

The name of the resource with policy assignments.

options
PolicyAssignmentsListForResourceOptionalParams

The options parameters.

Returns

listForResourceGroup(string, PolicyAssignmentsListForResourceGroupOptionalParams)

Gets policy assignments for the resource group.

function listForResourceGroup(resourceGroupName: string, options?: PolicyAssignmentsListForResourceGroupOptionalParams): PagedAsyncIterableIterator<PolicyAssignment, PolicyAssignment[], PageSettings>

Parameters

resourceGroupName

string

The name of the resource group that contains policy assignments.

options
PolicyAssignmentsListForResourceGroupOptionalParams

The options parameters.

Returns