PolicyAssignmentsOperationsExtensions.CreateByIdAsync(IPolicyAssignmentsOperations, String, PolicyAssignment, CancellationToken) PolicyAssignmentsOperationsExtensions.CreateByIdAsync(IPolicyAssignmentsOperations, String, PolicyAssignment, CancellationToken) Method

Definition

Creates a policy assignment by ID.

public static System.Threading.Tasks.Task<Microsoft.Azure.Management.ResourceManager.Models.PolicyAssignment> CreateByIdAsync (this Microsoft.Azure.Management.ResourceManager.IPolicyAssignmentsOperations operations, string policyAssignmentId, Microsoft.Azure.Management.ResourceManager.Models.PolicyAssignment parameters, System.Threading.CancellationToken cancellationToken = null);
static member CreateByIdAsync : Microsoft.Azure.Management.ResourceManager.IPolicyAssignmentsOperations * string * Microsoft.Azure.Management.ResourceManager.Models.PolicyAssignment * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Management.ResourceManager.Models.PolicyAssignment>
Parameters
operations
IPolicyAssignmentsOperations IPolicyAssignmentsOperations

The operations group for this extension method.

policyAssignmentId
String String

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

parameters
PolicyAssignment PolicyAssignment

Parameters for policy assignment.

cancellationToken
CancellationToken CancellationToken

The cancellation token.

Returns

Remarks

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 assigment, 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.

Applies to