Bylaw

Gallery › Key Vault › Azure built-in policies

Keys using RSA cryptography should have a specified minimum key size

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

Set the minimum allowed key size for use with your key vaults. Use of RSA 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_RSA_MinimumKeySize.json · 69 lines
{
  "properties": {
    "displayName": "Keys using RSA 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 RSA keys with small key sizes is not a secure practice and doesn't meet many industry certification requirements.",
    "metadata": {
      "version": "1.0.1",
      "category": "Key Vault"
    },
    "version": "1.0.1",
    "parameters": {
      "minimumRSAKeySize": {
        "type": "Integer",
        "metadata": {
          "displayName": "Minimum RSA key size",
          "description": "The minimum key size for RSA keys."
        },
        "allowedValues": [
          2048,
          3072,
          4096
        ]
      },
      "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"
          },
          {
            "field": "Microsoft.KeyVault.Data/vaults/keys/keyType",
            "in": [
              "RSA",
              "RSA-HSM"
            ]
          },
          {
            "field": "Microsoft.KeyVault.Data/vaults/keys/keySize",
            "less": "[parameters('minimumRSAKeySize')]"
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "1.0.1"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/82067dbb-e53b-4e06-b631-546d197452d9",
  "name": "82067dbb-e53b-4e06-b631-546d197452d9"
}

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