Plain JSON output is a policy definition with name and properties, emitted as written¶
Context and Problem Statement¶
EPAC was the default output when this was decided (ADR-0011); plain JSON has been the default since 0.6.0-alpha. Other tools, such as New-AzPolicyDefinition, the Azure CLI, Bicep's loadJsonContent() and Terraform, take the plain definition JSON instead. What shape should the second format have, and which EPAC rules does it keep?
Decision Drivers¶
- Usable as input to the common deployment tools without editing.
- The same determinism as EPAC output (ADR-0009).
- EPAC-specific rules stay in the EPAC emitter (ADR-0023).
Considered Options¶
{ "name", "properties" }, the layout of Azure's built-in definitions withoutid- The
propertiesobject only - The full ARM resource, with
typeandapiVersion
Decision Outcome¶
Chosen option: "{ "name", "properties" }", because it is the layout Azure itself publishes built-in definitions in, and it keeps the name with the definition.
{
"name": "storage-deny-public-network-access",
"properties": {
"displayName": "...",
"mode": "All",
"description": "...",
"metadata": { },
"parameters": { },
"policyRule": { }
}
}
- Selected with
Build-Bylaw -Format PlainJson. Files are named<policy name>.json, as for EPAC. - There is no
$schema,idorpolicyType, which Azure sets (Customfor every definition a user creates). Until 0.5.0-alpha,policyType: Customwas written, as Azure returns it; it was dropped because hand-written definitions, such as Azure Community Policy's, leave it out, so converting one and building it back added it (added 2026-11-30). There is a top-levelversiononly whenPropertieshasPolicyVersion(ADR-0016, added 2026-11-28). - Emitted as written:
- A literal effect stays literal:
Effect Denyemits"effect": "Deny", with no generated parameter. CategoryandVersionare optional.description,metadataandparametersare omitted when they are empty.- Parameters without a
DisplayNameget no generated one. - Everything else is shared with EPAC: key order, formatting, parameter casing, the policy rule,
Modifydetails, and all language-level validation. EPAC's own checks (BYL4xxx) don't apply, so anArmeffect is accepted.
Consequences¶
- Good, because the output can be passed straight to Azure tooling.
- Good, because the two formats differ only in the envelope and in EPAC's generated content.
- Bad, because a policy that builds as plain JSON may fail as EPAC, for example without a
Category. That is intended: EPAC's rules are stricter.
Confirmation¶
- Golden tests compile the policies in
tests/GoldenPlainJson/to plain JSON and compare them byte for byte.tests/Golden/GoldenRoots.psd1lists each golden folder with its format, for the tests and forbuild.ps1 -Task UpdateGolden. - A test checks that the plain JSON
policyRuleis identical to the EPAC one wherever the effect is the same, forEffectand forModify. - Azure doesn't publish a JSON schema for this layout, so a structural test checks the golden files:
namethenproperties, the required properties, no keys outside the layout, and apolicyRulewithifandthen.effect.