Share via


PolicyAssignmentCollection.CreateOrUpdate Method

Definition

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.

  • Request Path: /{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}
  • Operation Id: PolicyAssignments_Create
  • Default Api Version: 2022-06-01
  • Resource: PolicyAssignmentResource
public virtual Azure.ResourceManager.ArmOperation<Azure.ResourceManager.Resources.PolicyAssignmentResource> CreateOrUpdate (Azure.WaitUntil waitUntil, string policyAssignmentName, Azure.ResourceManager.Resources.PolicyAssignmentData data, System.Threading.CancellationToken cancellationToken = default);
abstract member CreateOrUpdate : Azure.WaitUntil * string * Azure.ResourceManager.Resources.PolicyAssignmentData * System.Threading.CancellationToken -> Azure.ResourceManager.ArmOperation<Azure.ResourceManager.Resources.PolicyAssignmentResource>
override this.CreateOrUpdate : Azure.WaitUntil * string * Azure.ResourceManager.Resources.PolicyAssignmentData * System.Threading.CancellationToken -> Azure.ResourceManager.ArmOperation<Azure.ResourceManager.Resources.PolicyAssignmentResource>
Public Overridable Function CreateOrUpdate (waitUntil As WaitUntil, policyAssignmentName As String, data As PolicyAssignmentData, Optional cancellationToken As CancellationToken = Nothing) As ArmOperation(Of PolicyAssignmentResource)

Parameters

waitUntil
WaitUntil

Completed if the method should wait to return until the long-running operation has completed on the service; Started if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples.

policyAssignmentName
String

The name of the policy assignment.

data
PolicyAssignmentData

Parameters for the policy assignment.

cancellationToken
CancellationToken

The cancellation token to use.

Returns

Exceptions

policyAssignmentName is an empty string, and was expected to be non-empty.

policyAssignmentName or data is null.

Applies to