Policy Exemptions - Create Or Update
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.
PUT https://management.azure.com/{scope}/providers/Microsoft.Authorization/policyExemptions/{policyExemptionName}?api-version=2022-07-01-preview
URI Parameters
Name | In | Required | Type | Description |
---|---|---|---|---|
policy
|
path | True |
string |
The name of the policy exemption to delete. |
scope
|
path | True |
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}' |
api-version
|
query | True |
string |
The API version to use for the operation. |
Request Body
Name | Required | Type | Description |
---|---|---|---|
properties.exemptionCategory | True |
The policy exemption category. Possible values are Waiver and Mitigated. |
|
properties.policyAssignmentId | True |
string |
The ID of the policy assignment that is being exempted. |
properties.assignmentScopeValidation |
The option whether validate the exemption is at or under the assignment scope. |
||
properties.description |
string |
The description of the policy exemption. |
|
properties.displayName |
string |
The display name of the policy exemption. |
|
properties.expiresOn |
string |
The expiration date and time (in UTC ISO 8601 format yyyy-MM-ddTHH:mm:ssZ) of the policy exemption. |
|
properties.metadata |
object |
The policy exemption metadata. Metadata is an open ended object and is typically a collection of key value pairs. |
|
properties.policyDefinitionReferenceIds |
string[] |
The policy definition reference ID list when the associated policy assignment is an assignment of a policy set definition. |
|
properties.resourceSelectors |
The resource selector list to filter policies by resource properties. |
Responses
Name | Type | Description |
---|---|---|
200 OK |
OK - Returns information about the updated policy exemption. |
|
201 Created |
Created - Returns information about the new policy exemption. |
|
Other Status Codes |
Error response describing why the operation failed. |
Security
azure_auth
Azure Active Directory OAuth2 Flow.
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Name | Description |
---|---|
user_impersonation | impersonate your user account |
Examples
Create or update a policy exemption |
Create or update a policy exemption with resource selectors |
Create or update a policy exemption
Sample request
PUT https://management.azure.com/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/resourceGroups/demoCluster/providers/Microsoft.Authorization/policyExemptions/DemoExpensiveVM?api-version=2022-07-01-preview
{
"properties": {
"policyAssignmentId": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyAssignments/CostManagement",
"policyDefinitionReferenceIds": [
"Limit_Skus"
],
"exemptionCategory": "Waiver",
"displayName": "Exempt demo cluster",
"description": "Exempt demo cluster from limit sku",
"metadata": {
"reason": "Temporary exemption for a expensive VM demo"
}
}
}
Sample response
{
"properties": {
"policyAssignmentId": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyAssignments/CostManagement",
"policyDefinitionReferenceIds": [
"Limit_Skus"
],
"exemptionCategory": "Waiver",
"displayName": "Exempt demo cluster",
"description": "Exempt demo cluster from limit sku",
"metadata": {
"reason": "Temporary exemption for a expensive VM demo"
}
},
"systemData": {
"createdBy": "string",
"createdByType": "User",
"createdAt": "2020-07-01T01:01:01.1075056Z",
"lastModifiedBy": "string",
"lastModifiedByType": "User",
"lastModifiedAt": "2020-07-01T01:01:01.1075056Z"
},
"id": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/resourceGroups/demoCluster/providers/Microsoft.Authorization/policyExemptions/DemoExpensiveVM",
"type": "Microsoft.Authorization/policyExemptions",
"name": "DemoExpensiveVM"
}
{
"properties": {
"policyAssignmentId": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyAssignments/CostManagement",
"policyDefinitionReferenceIds": [
"Limit_Skus"
],
"exemptionCategory": "Waiver",
"displayName": "Exempt demo cluster",
"description": "Exempt demo cluster from limit sku",
"metadata": {
"reason": "Temporary exemption for a expensive VM demo"
}
},
"systemData": {
"createdBy": "string",
"createdByType": "User",
"createdAt": "2020-07-01T01:01:01.1075056Z",
"lastModifiedBy": "string",
"lastModifiedByType": "User",
"lastModifiedAt": "2020-07-01T02:01:01.1075056Z"
},
"id": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/resourceGroups/demoCluster/providers/Microsoft.Authorization/policyExemptions/DemoExpensiveVM",
"type": "Microsoft.Authorization/policyExemptions",
"name": "DemoExpensiveVM"
}
Create or update a policy exemption with resource selectors
Sample request
PUT https://management.azure.com/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/resourceGroups/demoCluster/providers/Microsoft.Authorization/policyExemptions/DemoExpensiveVM?api-version=2022-07-01-preview
{
"properties": {
"policyAssignmentId": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyAssignments/CostManagement",
"policyDefinitionReferenceIds": [
"Limit_Skus"
],
"exemptionCategory": "Waiver",
"displayName": "Exempt demo cluster",
"description": "Exempt demo cluster from limit sku",
"metadata": {
"reason": "Temporary exemption for a expensive VM demo"
},
"assignmentScopeValidation": "Default",
"resourceSelectors": [
{
"name": "SDPRegions",
"selectors": [
{
"kind": "resourceLocation",
"in": [
"eastus2euap",
"centraluseuap"
]
}
]
}
]
}
}
Sample response
{
"properties": {
"policyAssignmentId": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyAssignments/CostManagement",
"policyDefinitionReferenceIds": [
"Limit_Skus"
],
"exemptionCategory": "Waiver",
"displayName": "Exempt demo cluster",
"description": "Exempt demo cluster from limit sku",
"metadata": {
"reason": "Temporary exemption for a expensive VM demo"
},
"assignmentScopeValidation": "Default",
"resourceSelectors": [
{
"name": "SDPRegions",
"selectors": [
{
"kind": "resourceLocation",
"in": [
"eastus2euap",
"centraluseuap"
]
}
]
}
]
},
"systemData": {
"createdBy": "string",
"createdByType": "User",
"createdAt": "2020-07-01T01:01:01.1075056Z",
"lastModifiedBy": "string",
"lastModifiedByType": "User",
"lastModifiedAt": "2020-07-01T01:01:01.1075056Z"
},
"id": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/resourceGroups/demoCluster/providers/Microsoft.Authorization/policyExemptions/DemoExpensiveVM",
"type": "Microsoft.Authorization/policyExemptions",
"name": "DemoExpensiveVM"
}
{
"properties": {
"policyAssignmentId": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyAssignments/CostManagement",
"policyDefinitionReferenceIds": [
"Limit_Skus"
],
"exemptionCategory": "Waiver",
"displayName": "Exempt demo cluster",
"description": "Exempt demo cluster from limit sku",
"metadata": {
"reason": "Temporary exemption for a expensive VM demo"
},
"assignmentScopeValidation": "Default",
"resourceSelectors": [
{
"name": "SDPRegions",
"selectors": [
{
"kind": "resourceLocation",
"in": [
"eastus2euap",
"centraluseuap"
]
}
]
}
]
},
"systemData": {
"createdBy": "string",
"createdByType": "User",
"createdAt": "2020-07-01T01:01:01.1075056Z",
"lastModifiedBy": "string",
"lastModifiedByType": "User",
"lastModifiedAt": "2020-07-01T02:01:01.1075056Z"
},
"id": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/resourceGroups/demoCluster/providers/Microsoft.Authorization/policyExemptions/DemoExpensiveVM",
"type": "Microsoft.Authorization/policyExemptions",
"name": "DemoExpensiveVM"
}
Definitions
Name | Description |
---|---|
Assignment |
The option whether validate the exemption is at or under the assignment scope. |
Cloud |
An error response from a policy operation. |
created |
The type of identity that created the resource. |
Error |
The resource management error additional info. |
Error |
Error Response |
exemption |
The policy exemption category. Possible values are Waiver and Mitigated. |
Policy |
The policy exemption. |
Resource |
The resource selector to filter policies by resource properties. |
Selector |
The selector expression. |
Selector |
The selector kind. |
system |
Metadata pertaining to creation and last modification of the resource. |
AssignmentScopeValidation
The option whether validate the exemption is at or under the assignment scope.
Name | Type | Description |
---|---|---|
Default |
string |
This option will validate the exemption is at or under the assignment scope. |
DoNotValidate |
string |
This option will bypass the validation the exemption scope is at or under the policy assignment scope. |
CloudError
An error response from a policy operation.
Name | Type | Description |
---|---|---|
error |
Error Response |
createdByType
The type of identity that created the resource.
Name | Type | Description |
---|---|---|
Application |
string |
|
Key |
string |
|
ManagedIdentity |
string |
|
User |
string |
ErrorAdditionalInfo
The resource management error additional info.
Name | Type | Description |
---|---|---|
info |
object |
The additional info. |
type |
string |
The additional info type. |
ErrorResponse
Error Response
Name | Type | Description |
---|---|---|
additionalInfo |
The error additional info. |
|
code |
string |
The error code. |
details |
The error details. |
|
message |
string |
The error message. |
target |
string |
The error target. |
exemptionCategory
The policy exemption category. Possible values are Waiver and Mitigated.
Name | Type | Description |
---|---|---|
Mitigated |
string |
This category of exemptions usually means the mitigation actions have been applied to the scope. |
Waiver |
string |
This category of exemptions usually means the scope is not applicable for the policy. |
PolicyExemption
The policy exemption.
Name | Type | Default value | Description |
---|---|---|---|
id |
string |
The ID of the policy exemption. |
|
name |
string |
The name of the policy exemption. |
|
properties.assignmentScopeValidation | Default |
The option whether validate the exemption is at or under the assignment scope. |
|
properties.description |
string |
The description of the policy exemption. |
|
properties.displayName |
string |
The display name of the policy exemption. |
|
properties.exemptionCategory |
The policy exemption category. Possible values are Waiver and Mitigated. |
||
properties.expiresOn |
string |
The expiration date and time (in UTC ISO 8601 format yyyy-MM-ddTHH:mm:ssZ) of the policy exemption. |
|
properties.metadata |
object |
The policy exemption metadata. Metadata is an open ended object and is typically a collection of key value pairs. |
|
properties.policyAssignmentId |
string |
The ID of the policy assignment that is being exempted. |
|
properties.policyDefinitionReferenceIds |
string[] |
The policy definition reference ID list when the associated policy assignment is an assignment of a policy set definition. |
|
properties.resourceSelectors |
The resource selector list to filter policies by resource properties. |
||
systemData |
Azure Resource Manager metadata containing createdBy and modifiedBy information. |
||
type |
string |
The type of the resource (Microsoft.Authorization/policyExemptions). |
ResourceSelector
The resource selector to filter policies by resource properties.
Name | Type | Description |
---|---|---|
name |
string |
The name of the resource selector. |
selectors |
Selector[] |
The list of the selector expressions. |
Selector
The selector expression.
Name | Type | Description |
---|---|---|
in |
string[] |
The list of values to filter in. |
kind |
The selector kind. |
|
notIn |
string[] |
The list of values to filter out. |
SelectorKind
The selector kind.
Name | Type | Description |
---|---|---|
policyDefinitionReferenceId |
string |
The selector kind to filter policies by the policy definition reference ID. |
resourceLocation |
string |
The selector kind to filter policies by the resource location. |
resourceType |
string |
The selector kind to filter policies by the resource type. |
resourceWithoutLocation |
string |
The selector kind to filter policies by the resource without location. |
systemData
Metadata pertaining to creation and last modification of the resource.
Name | Type | Description |
---|---|---|
createdAt |
string |
The timestamp of resource creation (UTC). |
createdBy |
string |
The identity that created the resource. |
createdByType |
The type of identity that created the resource. |
|
lastModifiedAt |
string |
The timestamp of resource last modification (UTC) |
lastModifiedBy |
string |
The identity that last modified the resource. |
lastModifiedByType |
The type of identity that last modified the resource. |