{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/microsoft-azure/json-schema/microsoft-azure-policy-definition-schema.json",
  "title": "PolicyDefinition",
  "description": "The policy definition.",
  "x-generated": "2026-11-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/microsoft-azure-policydefinitions-api-openapi.yml#/components/schemas/PolicyDefinition",
  "type": "object",
  "properties": {
    "properties": {
      "$ref": "#/$defs/PolicyDefinitionProperties",
      "description": "The policy definition properties.",
      "x-ms-client-flatten": true
    }
  },
  "allOf": [
    {
      "$ref": "#/$defs/ProxyResource"
    }
  ],
  "$defs": {
    "ExternalEvaluationEndpointSettings": {
      "type": "object",
      "description": "The settings of an external endpoint providing evaluation results.",
      "properties": {
        "kind": {
          "type": "string",
          "description": "The kind of the endpoint."
        },
        "details": {
          "description": "The details of the endpoint."
        }
      }
    },
    "ExternalEvaluationEnforcementSettings": {
      "type": "object",
      "description": "The details of the source of external evaluation results required by the policy during enforcement evaluation.",
      "properties": {
        "missingTokenAction": {
          "type": "string",
          "description": "What to do when evaluating an enforcement policy that requires an external evaluation and the token is missing. Possible values are Audit and Deny and language expressions are supported."
        },
        "resultLifespan": {
          "type": "string",
          "description": "The lifespan of the endpoint invocation result after which it's no longer valid. Value is expected to follow the ISO 8601 duration format and language expressions are supported."
        },
        "endpointSettings": {
          "$ref": "#/$defs/ExternalEvaluationEndpointSettings",
          "description": "The settings of an external endpoint providing evaluation results."
        },
        "roleDefinitionIds": {
          "type": "array",
          "description": "An array of the role definition Ids the assignment's MSI will need in order to invoke the endpoint.",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "ParameterDefinitionsValue": {
      "type": "object",
      "description": "The definition of a parameter that can be provided to the policy.",
      "properties": {
        "type": {
          "$ref": "#/$defs/ParameterType",
          "description": "The data type of the parameter."
        },
        "allowedValues": {
          "type": "array",
          "description": "The allowed values for the parameter.",
          "items": {}
        },
        "defaultValue": {
          "description": "The default value for the parameter if no value is provided."
        },
        "schema": {
          "description": "Provides validation of parameter inputs during assignment using a self-defined JSON schema. This property is only supported for object-type parameters and follows the Json.NET Schema 2019-09 implementation. You can learn more about using schemas at https://json-schema.org/ and test draft schemas at https://www.jsonschemavalidator.net/."
        },
        "metadata": {
          "$ref": "#/$defs/ParameterDefinitionsValueMetadata",
          "description": "General metadata for the parameter."
        }
      }
    },
    "ParameterDefinitionsValueMetadata": {
      "type": "object",
      "description": "General metadata for the parameter.",
      "properties": {
        "displayName": {
          "type": "string",
          "description": "The display name for the parameter."
        },
        "description": {
          "type": "string",
          "description": "The description of the parameter."
        },
        "strongType": {
          "type": "string",
          "description": "Used when assigning the policy definition through the portal. Provides a context aware list of values for the user to choose from."
        },
        "assignPermissions": {
          "type": "boolean",
          "description": "Set to true to have Azure portal create role assignments on the resource ID or resource scope value of this parameter during policy assignment. This property is useful in case you wish to assign permissions outside the assignment scope."
        }
      },
      "additionalProperties": {}
    },
    "ParameterType": {
      "type": "string",
      "description": "The data type of the parameter.",
      "enum": [
        "String",
        "Array",
        "Object",
        "Boolean",
        "Integer",
        "Float",
        "DateTime"
      ],
      "x-ms-enum": {
        "name": "ParameterType",
        "modelAsString": true,
        "values": [
          {
            "name": "String",
            "value": "String",
            "description": "The string parameter type."
          },
          {
            "name": "Array",
            "value": "Array",
            "description": "The array parameter type."
          },
          {
            "name": "Object",
            "value": "Object",
            "description": "The object parameter type."
          },
          {
            "name": "Boolean",
            "value": "Boolean",
            "description": "The boolean parameter type."
          },
          {
            "name": "Integer",
            "value": "Integer",
            "description": "The integer parameter type."
          },
          {
            "name": "Float",
            "value": "Float",
            "description": "The float parameter type."
          },
          {
            "name": "DateTime",
            "value": "DateTime",
            "description": "The date-time parameter type."
          }
        ]
      }
    },
    "PolicyDefinitionProperties": {
      "type": "object",
      "description": "The policy definition properties.",
      "properties": {
        "policyType": {
          "$ref": "#/$defs/PolicyType",
          "description": "The type of policy definition. Possible values are NotSpecified, BuiltIn, Custom, and Static."
        },
        "mode": {
          "type": "string",
          "description": "The policy definition mode. Some examples are All, Indexed, Microsoft.KeyVault.Data.",
          "default": "Indexed"
        },
        "displayName": {
          "type": "string",
          "description": "The display name of the policy definition."
        },
        "description": {
          "type": "string",
          "description": "The policy definition description."
        },
        "policyRule": {
          "description": "The policy rule."
        },
        "metadata": {
          "description": "The policy definition metadata.  Metadata is an open ended object and is typically a collection of key value pairs."
        },
        "parameters": {
          "type": "object",
          "description": "The parameter definitions for parameters used in the policy rule. The keys are the parameter names.",
          "additionalProperties": {
            "$ref": "#/$defs/ParameterDefinitionsValue"
          }
        },
        "version": {
          "type": "string",
          "description": "The policy definition version in #.#.# format."
        },
        "versions": {
          "type": "array",
          "description": "A list of available versions for this policy definition.",
          "items": {
            "type": "string"
          }
        },
        "externalEvaluationEnforcementSettings": {
          "$ref": "#/$defs/ExternalEvaluationEnforcementSettings",
          "description": "The details of the source of external evaluation results required by the policy during enforcement evaluation."
        }
      }
    },
    "PolicyType": {
      "type": "string",
      "description": "The type of policy definition. Possible values are NotSpecified, BuiltIn, Custom, and Static.",
      "enum": [
        "NotSpecified",
        "BuiltIn",
        "Custom",
        "Static"
      ],
      "x-ms-enum": {
        "name": "PolicyType",
        "modelAsString": true,
        "values": [
          {
            "name": "NotSpecified",
            "value": "NotSpecified",
            "description": "The not specified policy definition type."
          },
          {
            "name": "BuiltIn",
            "value": "BuiltIn",
            "description": "The built in policy definition type."
          },
          {
            "name": "Custom",
            "value": "Custom",
            "description": "The custom policy definition type."
          },
          {
            "name": "Static",
            "value": "Static",
            "description": "The static policy definition type."
          }
        ]
      }
    },
    "ProxyResource": {
      "type": "object",
      "title": "Proxy Resource",
      "description": "The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location",
      "allOf": [
        {
          "$ref": "#/$defs/Resource"
        }
      ]
    }
  }
}