Skip to content

BYL4xxx: Output

Reported when a policy or initiative is checked against the output format, before anything is written: what plain JSON needs for -Format PlainJson, the default, and EPAC's schema and conventions for -Format Epac.

Code Severity Meaning
BYL4001 Error EPAC needs a Category
BYL4002 Error EPAC needs a Version
BYL4003 Error Effect parameter not named effect
BYL4004 Error Effect parameter needs a default
BYL4005 Error Effect parameter needs two effects
BYL4006 Error Effect parameter display name isn't Effect
BYL4007 Error Literal effect, and a parameter already named effect
BYL4008 Error Effect from an Arm expression
BYL4009 Warning DateTime parameter
BYL4010 Warning Append details are an array
BYL4011 Error Definition group option EPAC doesn't allow
BYL4012 Error Plain JSON needs the definition scope
BYL4013 Error PolicyVersion in EPAC output

BYL4001

EPAC needs a Category (error)

EPAC's schema requires metadata.category on every policy and initiative.

To fix it: Add Category to Properties, or build with -Format PlainJson.

For example:

Properties @{
    DisplayName = 'Storage accounts require TLS 1.2'
    Category    = 'Storage'
    Version     = '1.0.0'
}

See ADR-0023.

BYL4002

EPAC needs a Version (error)

EPAC's schema requires metadata.version on every policy and initiative.

To fix it: Add Version to Properties, e.g. Version = '1.0.0'.

See ADR-0023.

BYL4003

Effect parameter not named effect (error)

EPAC finds a policy's effect parameter by its name, effect, to manage effects across assignments.

To fix it: Name the parameter Effect, or set -JsonName effect.

See ADR-0023.

BYL4004

Effect parameter needs a default (error)

EPAC requires the effect parameter to have a default, so an assignment that doesn't set it still works.

To fix it: Add -Default, e.g. -Default Audit.

See ADR-0023.

BYL4005

Effect parameter needs two effects (error)

EPAC requires the effect parameter to allow at least two different effects. Otherwise it isn't a choice.

To fix it: Allow at least two effects, such as the policy's effect and Disabled, or use a literal effect.

See ADR-0023.

BYL4006

Effect parameter display name isn't Effect (error)

EPAC requires the effect parameter's display name to be Effect, which Bylaw sets.

To fix it: Remove -DisplayName from the effect parameter.

See ADR-0023.

BYL4007

Literal effect, and a parameter already named effect (error)

With a literal effect, EPAC output gets a generated parameter named effect, so the assignment can still change it. A parameter of yours already has that name.

To fix it: Use that parameter for the effect: Effect (Param ).

See ADR-0023.

BYL4008

Effect from an Arm expression (error)

EPAC requires the effect to be [parameters('effect')], so it can be set per assignment. Any other expression can't be.

To fix it: Use Effect (Param Effect), or a literal effect.

See ADR-0023.

BYL4009

DateTime parameter (warning)

Azure accepts DateTime parameters, but EPAC's schema doesn't list the type, so editors that validate against it will flag the file. EPAC still deploys it.

To fix it: Nothing is needed. To avoid the warning, use a String parameter holding the date.

See ADR-0023.

BYL4010

Append details are an array (warning)

Azure requires Append's details to be an array, and EPAC deploys them as written, but EPAC's schema says details is an object, so editors that validate against it will flag the file.

To fix it: Nothing is needed: the output is correct for Azure.

See ADR-0029.

BYL4011

Definition group option EPAC doesn't allow (error)

EPAC's schema only allows a name and -AdditionalMetadataId on a definition group, so -DisplayName, -Category and -Description can't be emitted.

To fix it: Remove them, put the details in a policyMetadata object and link it with -AdditionalMetadataId, or build with -Format PlainJson.

See ADR-0035.

BYL4012

Plain JSON needs the definition scope (error)

In plain JSON, an initiative refers to each member by its full ID. For a policy in this build, that includes the scope the policy is deployed at, which Bylaw can't know.

To fix it: Pass Build-Bylaw -DefinitionScope with the management group or subscription, or set definitionScope in bylaw.json.

For example:

Build-Bylaw ./policies -Format PlainJson -DefinitionScope '/providers/Microsoft.Management/managementGroups/contoso'

See ADR-0035.

BYL4013

PolicyVersion in EPAC output (error)

PolicyVersion is the top-level version of Azure's custom policy versioning, which is in preview. EPAC's schemas don't have it, and its initiative schema doesn't allow other properties.

To fix it: Remove PolicyVersion, which leaves Version as metadata.version, or build with -Format PlainJson.

See ADR-0016.