Bylaw

Gallery › Key Vault › Azure built-in policies

Keys using AES cryptography should have a specified minimum key size

Doesn't convert yet Policy Audit Deny Disabled Mode Microsoft.KeyVault.Data Version 1.0.0

Set the minimum allowed key size for use with your key vaults. Use of AES keys with small key sizes is not a secure practice and doesn't meet many industry certification requirements.

ConvertTo-Bylaw can't convert this policy yet:

Azure Policy JSONKeys_OCT_MinimumKeySize.json · 74 lines
{
  "properties": {
    "displayName": "Keys using AES cryptography should have a specified minimum key size",
    "policyType": "BuiltIn",
    "mode": "Microsoft.KeyVault.Data",
    "description": "Set the minimum allowed key size for use with your key vaults. Use of AES keys with small key sizes is not a secure practice and doesn't meet many industry certification requirements.",
    "metadata": {
      "version": "1.0.0",
      "category": "Key Vault"
    },
    "version": "1.0.0",
    "parameters": {
      "minimumOCTKeySize": {
        "type": "Integer",
        "metadata": {
          "displayName": "Minimum OCT key size",
          "description": "The minimum key size for OCT keys."
        },
        "allowedValues": [
          128,
          192,
          256,
          512
        ]
      },
      "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. 'Disabled' turns off the policy."
        },
        "allowedValues": [
          "Audit",
          "Deny",
          "Disabled"
        ],
        "defaultValue": "Audit"
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.KeyVault.Data/vaults/keys"
          },
          {
            "field": "Microsoft.KeyVault.Data/vaults/keys/keyType",
            "in": [
              "oct",
              "oct-HSM"
            ]
          },
          {
            "field": "Microsoft.KeyVault.Data/vaults/keys/keySize",
            "exists": true
          },
          {
            "field": "Microsoft.KeyVault.Data/vaults/keys/keySize",
            "less": "[parameters('minimumOCTKeySize')]"
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/51fb1409-3c36-43c4-a750-ce814ac35ea6",
  "name": "51fb1409-3c36-43c4-a750-ce814ac35ea6"
}

Source: built-in-policies/policyDefinitions/Key Vault/Keys_OCT_MinimumKeySize.json in Azure/azure-policy, under the MIT licence.