PolicyExemptionCollection.CreateOrUpdateAsync Method

Definition

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

  • Request Path. : /{scope}/providers/Microsoft.Authorization/policyExemptions/{policyExemptionName}.
  • Operation Id. : PolicyExemptions_CreateOrUpdate.
  • Default Api Version. : 2025-12-01-preview.
public virtual System.Threading.Tasks.Task<Azure.ResourceManager.ArmOperation<Azure.ResourceManager.Resources.Policy.PolicyExemptionResource>> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string policyExemptionName, Azure.ResourceManager.Resources.Policy.PolicyExemptionData data, System.Threading.CancellationToken cancellationToken = default);
abstract member CreateOrUpdateAsync : Azure.WaitUntil * string * Azure.ResourceManager.Resources.Policy.PolicyExemptionData * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.ResourceManager.ArmOperation<Azure.ResourceManager.Resources.Policy.PolicyExemptionResource>>
override this.CreateOrUpdateAsync : Azure.WaitUntil * string * Azure.ResourceManager.Resources.Policy.PolicyExemptionData * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.ResourceManager.ArmOperation<Azure.ResourceManager.Resources.Policy.PolicyExemptionResource>>
Public Overridable Function CreateOrUpdateAsync (waitUntil As WaitUntil, policyExemptionName As String, data As PolicyExemptionData, Optional cancellationToken As CancellationToken = Nothing) As Task(Of ArmOperation(Of PolicyExemptionResource))

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.

policyExemptionName
String

The name of the policy exemption to get.

data
PolicyExemptionData

Parameters for the policy exemption.

cancellationToken
CancellationToken

The cancellation token to use.

Returns

Exceptions

policyExemptionName or data is null.

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

Applies to