Gallery › Policy › Azure Community Policy
Deny policy exemption without expiration date
Converted Policy Audit Deny Disabled Mode All Version 1.0.0
Deny policy exemption without expiration date
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONazurepolicy.json · 45 lines
{
"name": "9f841354-ad54-4acf-903f-f3fc541a8838",
"type": "Microsoft.Authorization/policyDefinitions",
"properties": {
"displayName": "Deny policy exemption without expiration date",
"description": "Deny policy exemption without expiration date",
"metadata": {
"version": "1.0.0",
"category": "Policy"
},
"mode": "All",
"parameters": {
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "Deny, Audit or Disabled the execution of the Policy"
},
"allowedValues": [
"Deny",
"Audit",
"Disabled"
],
"defaultValue": "Audit"
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Authorization/policyExemptions"
},
{
"field": "Microsoft.Authorization/policyExemptions/expiresOn",
"exists": false
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
}
}
}Bylaw9f841354-ad54-4acf-903f-f3fc541a8838.bylaw.ps1 · 27 lines
# Converted from azurepolicy.json by ConvertTo-Bylaw.
Policy '9f841354-ad54-4acf-903f-f3fc541a8838' {
Properties @{
DisplayName = 'Deny policy exemption without expiration date'
Description = 'Deny policy exemption without expiration date'
Version = '1.0.0'
Category = 'Policy'
Mode = 'All'
}
Parameter Effect @{
AllowedValues = @('Deny', 'Audit', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'Deny, Audit or Disabled the execution of the Policy'
}
Resource 'Microsoft.Authorization/policyExemptions' {
Require 'expiresOn exists' {
Field expiresOn | Must -Exist
}
}
Effect (Param Effect)
}Source: policyDefinitions/Policy/deny-policy-exemption-without-expiration-date/azurepolicy.json in Azure/Community-Policy, under the MIT licence.
Bylaw