Bylaw

Gallery › BuiltInPolicyTest › Azure built-in policies

[Deprecated]: Key Vault Managed HSM keys using elliptic curve cryptography should have the specified curve names. Versioning Test BuiltIn.

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

This is a test policy only for internal use by Policy team. Keys backed by elliptic curve cryptography can have different curve names. Some applications are only compatible with specific elliptic curve keys. Enforce the types of elliptic curve keys that are allowed to be created in your environment.

ConvertTo-Bylaw can't convert this policy yet:

Azure Policy JSONManagedHsm_Keys_EC_AllowedCurveNames_Versioning_Test.json · 79 lines
{
  "properties": {
    "policyType": "BuiltIn",
    "displayName": "[Deprecated]: Key Vault Managed HSM keys using elliptic curve cryptography should have the specified curve names. Versioning Test BuiltIn.",
    "description": "This is a test policy only for internal use by Policy team. Keys backed by elliptic curve cryptography can have different curve names. Some applications are only compatible with specific elliptic curve keys. Enforce the types of elliptic curve keys that are allowed to be created in your environment.",
    "metadata": {
      "category": "BuiltInPolicyTest",
      "version": "2.1.0-deprecated",
      "deprecated": true
    },
    "version": "2.1.0",
    "mode": "Microsoft.ManagedHSM.Data",
    "parameters": {
      "allowedECNamesV2": {
        "allowedValues": [
          "P-256",
          "P-256K",
          "P-384",
          "P-521"
        ],
        "defaultValue": [
          "P-256",
          "P-256K",
          "P-384",
          "P-521"
        ],
        "metadata": {
          "description": "The list of allowed curve names for elliptic curve cryptography certificates.",
          "displayName": "Allowed elliptic curve names"
        },
        "type": "Array"
      },
      "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"
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.ManagedHSM.Data/managedHsms/keys"
          },
          {
            "field": "Microsoft.ManagedHSM.Data/managedHsms/keys/keyType",
            "in": [
              "EC",
              "EC-HSM"
            ]
          },
          {
            "field": "Microsoft.ManagedHSM.Data/managedHsms/keys/ellipticCurveName",
            "notIn": "[parameters('allowedECNamesV2')]"
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "2.1.0",
      "2.0.0",
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/98cec160-6f57-4d11-86e2-0a03290a3a8a",
  "name": "98cec160-6f57-4d11-86e2-0a03290a3a8a"
}

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