Skip to content

How Properties keys map into the definition, and their defaults

Context and Problem Statement

Properties @{ } accepts DisplayName, Description, Category, Version, Mode, Preview, Deprecated and Metadata. Where does each key go, which keys are required, and what are the defaults? Azure has also added a top-level version property for custom policy versioning, which is in preview, alongside the customary metadata.version.

Considered Options

  • Version maps to metadata.version only, and Mode defaults to All
  • Version maps to both metadata.version and properties.version
  • No default Mode (it must be set)

Decision Outcome

Chosen option: "Version maps to metadata.version only, and Mode defaults to All".

Key Emitted as Required Validation
DisplayName properties.displayName yes 1 to 128 characters
Description properties.description no at most 512 characters
Mode properties.mode no, defaults to All All or Indexed, ignoring case, emitted as All or Indexed
Version metadata.version no SemVer major.minor.patch, optionally with a -preview or -deprecated suffix
PolicyVersion properties.version, plain JSON only no major.minor.patch, optionally with -preview, as Learn gives it. EPAC output reports BYL4013.
Category metadata.category no string
Preview metadata.preview no boolean
Deprecated metadata.deprecated no boolean
Metadata merged into metadata no hashtable. A key that clashes with a generated key (version, category, preview, deprecated) is an error, and so is deployedBy (ADR-0011). Each value is at most 1024 characters once serialised.
  • Unknown keys fail the build. The error lists the valid keys and suggests the closest match.
  • Resource provider modes (such as Microsoft.Kubernetes.Data) are not supported in language version 1.0. They have different rule and effect requirements and would need their own ADR.
  • All is the default because it is what Azure PowerShell uses. Policies on tags or location usually want Indexed, so the compiler warns when Mode is All and the rule references tags or location.
  • The top-level properties.version was at first not emitted, because custom policy versioning is still in preview. On 2026-11-28 PolicyVersion was added for it, as a key of its own rather than a second use of Version: the Azure Landing Zones Library has initiatives whose top-level version (1.0.0) differs from metadata.version (1.1.0), so one key can't express both (ADR-0042). Only plain JSON output writes it: EPAC's schemas don't have a top-level version, and its initiative schema forbids other properties. Initiative members that pin -Version are checked against PolicyVersion when the policy has one (BYL3126), and otherwise warned that the pin may not select the version expected (BYL3129).
  • -deprecated was added beside -preview on 2026-11-28 (Milestone 5): Azure's versioning convention marks retired definitions with it, as the built-in policies and 56 of the Azure Landing Zones Library's definitions do (ADR-0042).

Consequences

  • Good, because the output follows established built-in policy conventions.
  • Good, because PolicyVersion lets plain JSON output use Azure's preview versioning, without changing what Version means.
  • Bad, because EPAC output can't use it until EPAC's schemas do.

Confirmation

Unit tests cover each key, each validation rule and the defaults.

More Information