Bylaw

Gallery › Key Vault › Azure built-in policies

Certificates should use allowed key types

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

Manage your organizational compliance requirements by restricting the key types allowed for certificates.

ConvertTo-Bylaw can't convert this policy yet:

Azure Policy JSONCertificates_AllowedKeyTypes.json · 70 lines
{
  "properties": {
    "displayName": "Certificates should use allowed key types",
    "policyType": "BuiltIn",
    "mode": "Microsoft.KeyVault.Data",
    "description": "Manage your organizational compliance requirements by restricting the key types allowed for certificates.",
    "metadata": {
      "version": "2.1.0",
      "category": "Key Vault"
    },
    "version": "2.1.0",
    "parameters": {
      "allowedKeyTypes": {
        "type": "Array",
        "metadata": {
          "displayName": "Allowed key types",
          "description": "The list of allowed certificate key types."
        },
        "allowedValues": [
          "RSA",
          "RSA-HSM",
          "EC",
          "EC-HSM"
        ],
        "defaultValue": [
          "RSA",
          "RSA-HSM"
        ]
      },
      "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",
          "Audit",
          "deny",
          "Deny",
          "disabled",
          "Disabled"
        ],
        "defaultValue": "Audit"
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.KeyVault.Data/vaults/certificates"
          },
          {
            "field": "Microsoft.KeyVault.Data/vaults/certificates/keyProperties.keyType",
            "notIn": "[parameters('allowedKeyTypes')]"
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "2.1.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/1151cede-290b-4ba0-8b38-0ad145ac888f",
  "name": "1151cede-290b-4ba0-8b38-0ad145ac888f"
}

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