Bylaw

Gallery › BuiltInPolicyTest › Azure built-in policies

[Deprecated]: Keys should have a rotation policy within the specified number of days after creation. Versioning Test BuiltIn.

Doesn't convert yet Policy Audit Disabled Mode Microsoft.KeyVault.Data Version 2.1.0-deprecated Deprecated

This is a test policy only for internal use by Policy team. Manage your organizational compliance requirements by specifying the maximum number of days after key creation until it must be rotated.

ConvertTo-Bylaw can't convert this policy yet:

Azure Policy JSONKeys_KeyRotationPolicy_MaximumDaysToRotate_Versioning_Test.json · 67 lines
{
  "properties": {
    "displayName": "[Deprecated]: Keys should have a rotation policy within the specified number of days after creation. Versioning Test BuiltIn.",
    "policyType": "BuiltIn",
    "mode": "Microsoft.KeyVault.Data",
    "description": "This is a test policy only for internal use by Policy team. Manage your organizational compliance requirements by specifying the maximum number of days after key creation until it must be rotated.",
    "metadata": {
      "version": "2.1.0-deprecated",
      "category": "BuiltInPolicyTest",
      "deprecated": true
    },
    "version": "2.1.0",
    "parameters": {
      "maximumDaysToRotateV2": {
        "type": "Integer",
        "metadata": {
          "displayName": "The maximum days to rotate",
          "description": "The maximum number of days after key creation until it must be rotated."
        }
      },
      "effect": {
        "type": "string",
        "metadata": {
          "displayName": "Effect",
          "description": "'Audit' allows a non-compliant resource to be created, but flags it as non-compliant.  'Disable' turns off the policy."
        },
        "allowedValues": [
          "Audit",
          "Disabled"
        ],
        "defaultValue": "Audit"
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.KeyVault.Data/vaults/keys"
          },
          {
            "anyOf": [
              {
                "field": "Microsoft.KeyVault.Data/vaults/keys/scheduledRotationDate",
                "exists": "false"
              },
              {
                "field": "Microsoft.KeyVault.Data/vaults/keys/scheduledRotationDate",
                "greater": "[addDays(field('Microsoft.KeyVault.Data/vaults/keys/attributes.createdOn'), parameters('maximumDaysToRotateV2'))]"
              }
            ]
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "2.1.0",
      "2.0.0",
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/fa8af49a-f61d-4f56-9138-46b77d37df43",
  "name": "fa8af49a-f61d-4f56-9138-46b77d37df43"
}

Source: built-in-policies/policyDefinitions/BuiltInPolicyTest/Keys_KeyRotationPolicy_MaximumDaysToRotate_Versioning_Test.json in Azure/azure-policy, under the MIT licence.