IPolicyExemptionsOperations.CreateOrUpdateWithHttpMessagesAsync Method

Definition

Creates or updates a policy exemption.

public System.Threading.Tasks.Task<Microsoft.Rest.Azure.AzureOperationResponse<Microsoft.Azure.Management.ResourceManager.Models.PolicyExemption>> CreateOrUpdateWithHttpMessagesAsync (string scope, string policyExemptionName, Microsoft.Azure.Management.ResourceManager.Models.PolicyExemption parameters, System.Collections.Generic.Dictionary<string,System.Collections.Generic.List<string>> customHeaders = default, System.Threading.CancellationToken cancellationToken = default);
abstract member CreateOrUpdateWithHttpMessagesAsync : string * string * Microsoft.Azure.Management.ResourceManager.Models.PolicyExemption * System.Collections.Generic.Dictionary<string, System.Collections.Generic.List<string>> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Rest.Azure.AzureOperationResponse<Microsoft.Azure.Management.ResourceManager.Models.PolicyExemption>>
Public Function CreateOrUpdateWithHttpMessagesAsync (scope As String, policyExemptionName As String, parameters As PolicyExemption, Optional customHeaders As Dictionary(Of String, List(Of String)) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of AzureOperationResponse(Of PolicyExemption))

Parameters

scope
String

The scope of the policy exemption. 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}'

policyExemptionName
String

The name of the policy exemption to delete.

parameters
PolicyExemption

Parameters for the policy exemption.

customHeaders
Dictionary<String,List<String>>

The headers that will be added to request.

cancellationToken
CancellationToken

The cancellation token.

Returns

Exceptions

Thrown when the operation returned an invalid status code

Thrown when unable to deserialize the response

Thrown when a required parameter is null

Remarks

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.

Applies to