last sync: 2021-Sep-24 16:09:49 UTC

Azure Policy definition

Certificates should have the specified lifetime action triggers

Name Certificates should have the specified lifetime action triggers
Azure Portal
Id 12ef42cb-9903-4e39-9c26-422d29570417
Version 2.0.1
details on versioning
Category Key Vault
Microsoft docs
Description Manage your organizational compliance requirements by specifying whether a certificate lifetime action is triggered at a specific percentage of its lifetime or at a certain number of days prior to its expiration.
Mode Microsoft.KeyVault.Data
Type BuiltIn
Preview FALSE
Deprecated FALSE
Effect Default: audit
Allowed: (audit, deny, disabled)
Used RBAC Role none
History
Date/Time (UTC ymd) (i) Change type Change detail
2021-08-30 14:27:30 change Patch, old suffix: preview (2.0.0-preview > 2.0.1)
2020-09-02 14:03:46 change Previous DisplayName: [Preview]: Manage certificate lifetime action triggers
2019-11-19 11:26:09 change Previous DisplayName: [Preview]: Certificates should have the specified lifetime action trigger
Used in Initiatives none
JSON Changes

JSON
{
  "displayName": "Certificates should have the specified lifetime action triggers",
  "policyType": "BuiltIn",
  "mode": "Microsoft.KeyVault.Data",
  "description": "Manage your organizational compliance requirements by specifying whether a certificate lifetime action is triggered at a specific percentage of its lifetime or at a certain number of days prior to its expiration.",
  "metadata": {
    "version": "2.0.1",
    "category": "Key Vault"
  },
  "parameters": {
    "maximumPercentageLife": {
      "type": "Integer",
      "metadata": {
        "displayName": "The maximum lifetime percentage",
        "description": "Enter the percentage of lifetime of the certificate when you want to trigger the policy action. For example, to trigger a policy action at 80% of the certificate's valid life, enter '80'."
      }
    },
    "minimumDaysBeforeExpiry": {
      "type": "Integer",
      "metadata": {
        "displayName": "The minimum days before expiry",
        "description": "Enter the days before expiration of the certificate when you want to trigger the policy action. For example, to trigger a policy action 90 days before the certificate's expiration, enter '90'."
      }
    },
    "effect": {
      "type": "String",
      "metadata": {
        "displayName": "Effect",
        "description": "'Audit' allows a non-compliant resource to be created, but flags it as non-compliant. 'Deny' blocks the resource creation. 'Disable' turns off the policy."
      },
      "allowedValues": [
        "audit",
        "deny",
        "disabled"
      ],
      "defaultValue": "audit"
    }
  },
  "policyRule": {
    "if": {
      "allOf": [
        {
          "field": "type",
          "equals": "Microsoft.KeyVault.Data/vaults/certificates"
        },
        {
          "anyOf": [
            {
              "allOf": [
                {
                  "field": "Microsoft.KeyVault.Data/vaults/certificates/lifetimeAction.daysBeforeExpiry",
                  "exists": true
                },
                {
                  "field": "Microsoft.KeyVault.Data/vaults/certificates/lifetimeAction.daysBeforeExpiry",
                  "less": "[parameters('minimumDaysBeforeExpiry')]"
                }
              ]
            },
            {
              "allOf": [
                {
                  "field": "Microsoft.KeyVault.Data/vaults/certificates/lifetimeAction.lifetimePercentage",
                  "exists": true
                },
                {
                  "field": "Microsoft.KeyVault.Data/vaults/certificates/lifetimeAction.lifetimePercentage",
                  "greater": "[parameters('maximumPercentageLife')]"
                }
              ]
            }
          ]
        }
      ]
    },
    "then": {
      "effect": "[parameters('effect')]"
    }
  }
}