PolicyAssignmentsOperationsExtensions.CreateAsync Method

Definition

Creates or updates a policy assignment.

public static System.Threading.Tasks.Task<Microsoft.Azure.Management.ResourceManager.Fluent.Models.PolicyAssignmentInner> CreateAsync (this Microsoft.Azure.Management.ResourceManager.Fluent.IPolicyAssignmentsOperations operations, string scope, string policyAssignmentName, Microsoft.Azure.Management.ResourceManager.Fluent.Models.PolicyAssignmentInner parameters, System.Threading.CancellationToken cancellationToken = default);
static member CreateAsync : Microsoft.Azure.Management.ResourceManager.Fluent.IPolicyAssignmentsOperations * string * string * Microsoft.Azure.Management.ResourceManager.Fluent.Models.PolicyAssignmentInner * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Management.ResourceManager.Fluent.Models.PolicyAssignmentInner>
<Extension()>
Public Function CreateAsync (operations As IPolicyAssignmentsOperations, scope As String, policyAssignmentName As String, parameters As PolicyAssignmentInner, Optional cancellationToken As CancellationToken = Nothing) As Task(Of PolicyAssignmentInner)

Parameters

operations
IPolicyAssignmentsOperations

The operations group for this extension method.

scope
String

The scope of the policy assignment. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'

policyAssignmentName
String

The name of the policy assignment.

parameters
PolicyAssignmentInner

Parameters for the policy assignment.

cancellationToken
CancellationToken

The cancellation token.

Returns

Remarks

This operation creates or updates a policy assignment with the given scope and name. Policy assignments apply to all resources contained within their scope. For example, when you assign a policy at resource group scope, that policy applies to all resources in the group.

Applies to