Bylaw

Gallery › Key Vault › Azure built-in policies

[Preview]: Azure Key Vault Managed HSM keys using RSA cryptography should have a specified minimum key size

Doesn't convert yet Policy Audit Deny Disabled Mode Microsoft.ManagedHSM.Data Version 1.0.1-preview Preview

To use this policy in preview, you must first follow these instructions at https://aka.ms/mhsmgovernance. 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 JSONManagedHsm_Keys_RSA_MinimumKeySize.json · 75 lines
{
  "properties": {
    "policyType": "BuiltIn",
    "displayName": "[Preview]: Azure Key Vault Managed HSM keys using RSA cryptography should have a specified minimum key size",
    "description": "To use this policy in preview, you must first follow these instructions at https://aka.ms/mhsmgovernance. 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.\n",
    "metadata": {
      "category": "Key Vault",
      "version": "1.0.1-preview",
      "preview": true
    },
    "version": "1.0.1-preview",
    "mode": "Microsoft.ManagedHSM.Data",
    "parameters": {
      "effect": {
        "allowedValues": [
          "Audit",
          "Deny",
          "Disabled"
        ],
        "defaultValue": "Audit",
        "metadata": {
          "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.",
          "displayName": "Effect"
        },
        "type": "String"
      },
      "minimumRSAKeySize": {
        "allowedValues": [
          2048,
          3072,
          4096
        ],
        "metadata": {
          "description": "The minimum key size for RSA keys.",
          "displayName": "Minimum RSA key size"
        },
        "type": "Integer",
        "defaultValue": 2048
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.ManagedHSM.Data/managedHsms/keys"
          },
          {
            "field": "Microsoft.ManagedHSM.Data/managedHsms/keys/keyType",
            "in": [
              "RSA",
              "RSA-HSM"
            ]
          },
          {
            "field": "Microsoft.ManagedHSM.Data/managedHsms/keys/keySize",
            "exists": true
          },
          {
            "field": "Microsoft.ManagedHSM.Data/managedHsms/keys/keySize",
            "less": "[parameters('minimumRSAKeySize')]"
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "1.0.1-PREVIEW"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/86810a98-8e91-4a44-8386-ec66d0de5d57",
  "name": "86810a98-8e91-4a44-8386-ec66d0de5d57"
}

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