last sync: 2020-Oct-23 19:29:54 UTC

Azure Policy

[Preview]: Keys should have the specified maximum validity period

Name [Preview]: Keys should have the specified maximum validity period
Id 49a22571-d204-4c91-a7b6-09b1a586fbc9
Version 1.0.0-preview
details on versioning
Category Key Vault
Description Manage your organizational compliance requirements by specifying the maximum amount of time in days that a key can be valid within your key vault.
Mode Microsoft.KeyVault.Data
Type BuiltIn
Preview True
Deprecated FALSE
Effect Default: Audit
Allowed: (Audit,Deny,Disabled)
Used RBAC Role none
History
Date/Time (UTC ymd) (i) Change type Change detail
2020-10-16 12:27:50 add 49a22571-d204-4c91-a7b6-09b1a586fbc9
Used in Initiatives none
Json
{
  "properties": {
  "displayName": "[Preview]: Keys should have the specified maximum validity period",
    "policyType": "BuiltIn",
    "mode": "Microsoft.KeyVault.Data",
    "description": "Manage your organizational compliance requirements by specifying the maximum amount of time in days that a key can be valid within your key vault.",
    "metadata": {
      "version": "1.0.0-preview",
      "category": "Key Vault",
      "preview": true
    },
    "parameters": {
      "maximumValidityInDays": {
        "type": "Integer",
        "metadata": {
          "displayName": "The maximum validity period in days",
          "description": "Specify the maximum number of days a key can be valid for. Keys should be ephemeral. Using a key with a long validity period is not recommended."
        }
      },
      "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/keys"
          },
          {
            "anyOf": [
              {
                "field": "Microsoft.KeyVault.Data/vaults/keys/attributes.expiresOn",
                "exists": false
              },
              {
                "field": "Microsoft.KeyVault.Data/vaults/keys/attributes.expiresOn",
              "greater": "[addDays(field('Microsoft.KeyVault.Data/vaults/keys/attributes.createdOn'), parameters('maximumValidityInDays'))]"
              }
            ]
          }
        ]
      },
      "then": {
      "effect": "[parameters('effect')]"
      }
    }
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/49a22571-d204-4c91-a7b6-09b1a586fbc9",
  "type": "Microsoft.Authorization/policyDefinitions",
  "name": "49a22571-d204-4c91-a7b6-09b1a586fbc9"
}