Initiative is a top-level keyword like Policy, with PolicyDefinition for each policy it includes¶
Context and Problem Statement¶
An initiative (policy set definition) groups policy definitions so they're assigned together, and passes its own parameters to theirs. Most real policy estates assign initiatives rather than single policies. The Azure Landing Zones Library has 60 custom initiatives with 685 members:
- 430 members (63%) are built-in definitions, referenced by ID. 255 (37%) are custom definitions from the same library.
- 511 members (75%) pin a
definitionVersion, usually1.*.*. - 2,365 of 2,496 member parameter values (95%) pass an initiative parameter straight through, as
[parameters('x')]. 106 are ARM expressions, and 25 are literals. In 102 cases, one initiative parameter feeds several members. - 15 members include a definition that another member of the same initiative also includes, with different parameters and a different reference ID.
- None uses policy definition groups. Groups belong to the Regulatory Compliance feature, which Learn marks as preview.
How is an initiative written in Bylaw?
Decision Drivers¶
- An initiative reads like a policy: the same
PropertiesandParameterkeywords, in the same kind of file. - Members from the same build are referenced by policy name, the same identity
Policy 'name'gives them (ADR-0010). - Built-in members, which are most members, are as easy to include as custom ones.
- Mistakes that Azure only reports at deployment or assignment fail the build instead (ADR-0034).
Considered Options¶
- An
Initiativekeyword with aPolicyDefinitionkeyword per member - Initiatives as a hashtable or data file next to the policies
- A
Policy -Initiativeparameter that adds a policy to a named initiative
Decision Outcome¶
Chosen option: "An Initiative keyword with a PolicyDefinition keyword per member".
Initiative 'tagging-baseline' {
Properties @{
DisplayName = 'Tagging baseline'
Category = 'Tags'
Version = '1.0.0'
}
Parameter Effect -AllowedValues Audit, Deny, Disabled -Default Audit
Parameter MandatoryTags -Type Array -Default @('CostCenter', 'Owner')
# A policy from this build, by name.
PolicyDefinition 'tags-require-mandatory-tags' -Parameters @{
mandatoryTags = Param MandatoryTags
effect = Param Effect
}
# A built-in policy, by ID, pinned to its major version.
PolicyDefinition -Id cd3aa116-8754-49c9-a813-ad46512ece54 -ReferenceId 'InheritCostCenter' -Version '1.*.*' -Parameters @{
tagName = 'CostCenter'
}
}
Initiative¶
Initiative 'name' { }is exported, likePolicy, and can be in the same files as policies. Its inner keywords exist only inside it (ADR-0005).- The name follows ADR-0010. Names are unique across a build, ignoring case, across policies and initiatives together: they are both definition names, and their output files can share a folder (ADR-0035).
PropertiestakesDisplayName(required),Description,Category,Version,Preview,DeprecatedandMetadata, with the same rules and limits as for a policy (ADR-0016).Modeis a compile error: it belongs to the members.Parameterdeclares initiative parameters, as for a policy. A parameter no member uses is a warning (ADR-0021).- At most 1000 members and 400 parameters, as Learn documents. More is a compile error.
- Only
Properties,Parameter,PolicyDefinitionandDefinitionGroupare allowed inside. An initiative has no rule and no effect.
PolicyDefinition¶
PolicyDefinition 'policy-name'includes a policy from the same build, by itsPolicyname, matched ignoring case. Whether it exists is checked once every file has compiled (ADR-0034).PolicyDefinition -Id '/providers/Microsoft.Authorization/policyDefinitions/<guid>'includes a built-in policy. Built-in policies are named by GUID, so-Id <guid>on its own is short for that ID, and keeps the line short. Any other definition ID, such as a custom definition deployed outside this build, is also accepted:-Idemits the ID as written.- When a member's options make a long line, they go in a hashtable, one per line: see Options in a hashtable.
-ReferenceIdis the member'spolicyDefinitionReferenceId. It defaults to the policy name for a member from the build, and is required for-Id. Reference IDs are unique within an initiative, ignoring case. A policy can be a member more than once, with different reference IDs, as 15 ALZ members are.-Parameters @{ name = value }passes values to the member's parameters. A value is a literal,Param(an initiative parameter),Arm, orResourceGroupTag. Each is emitted as{ "value": ... }. An[ordered]hashtable keeps its order, and a plain one is sorted, as forDeployment -Parameters(ADR-0031). Names are emitted as written and matched against the member's parameters ignoring case, as ARM does (ADR-0034).-Version '1.*.*'emitsdefinitionVersion. It is what Azure accepts,{major}.{minor|*}[.*][-preview]: a major version above 0, then a minor version or*, then optionally.*, with an optional-previewsuffix, each number without leading zeros:^[1-9]\d*\.(0|[1-9]\d*|\*)(\.\*)?(-preview)?$. Amended 2026-12-01 (#120): the pattern was^\d+\.(\d+|\*)\.(\d+|\*)(-preview)?$, from Learn, until a sandbox run showed that Azure rejects a fixed patch such as1.0.3, on an initiative member as on an assignment, and a major version of 0 or a leading zero, and accepts two segments, such as2.*and2.0. For a member from the build, the pattern must match the policy'sVersion(ADR-0034).-Groupnames the member's policy definition groups (groupNames).- The name matches the initiative's
policyDefinitionsarray, asDefinitionGroupmatchespolicyDefinitionGroups. It was firstMember, but outside anInitiativePowerShell runsGet-MemberforMember, adding theGet-prefix itself, so a strayMemberwould run silently instead of giving Bylaw's error (ADR-0005).Includewas also considered, but psake has anIncludefunction.
DefinitionGroup¶
DefinitionGroup 'name' -DisplayName ... -Category ... -Description ... -AdditionalMetadataId ...declares a policy definition group. Only the name is required.- A
PolicyDefinition -Groupvalue that noDefinitionGroupdeclares is a compile error. A group no member uses was an error too, until 2026-11-30, when it became a warning (BYL3114), one for all of an initiative's empty groups: Azure allows them, and regulatory compliance initiatives declare a group for every control of a standard, including those no policy checks, so they show in the compliance view. Azure Community Policy's NZISM initiative has 151 groups, of which 29 have members. - Its options can go in a hashtable, as a member's can (below).
- The name matches Azure's
policyDefinitionGroupsproperty and Learn's "policy definition group".PolicyGroupwas considered, but reads as a group of policies in its own right, which is what an initiative is. PlainGroupcan't be used, because PowerShell'sgroupalias forGroup-Objectwould run instead of a function of that name (ADR-0005).
Options in a hashtable¶
Added 2026-12-01. PolicyDefinition and DefinitionGroup take their options in the three forms Parameter takes (ADR-0021): named parameters, a hashtable after the name, or a hashtable with Name as one of its keys. The keys are the option names, matched ignoring case.
DefinitionGroup 'Compute & VM Security' -Category 'Compute' -DisplayName 'Compute & VM Security'
DefinitionGroup 'Compute & VM Security' @{
Category = 'Compute'
DisplayName = 'Compute & VM Security'
Description = 'The policies that cover compute and VM security'
}
PolicyDefinition 'tags-inherit-from-resource-group' @{
ReferenceId = 'inherit-cost-center'
Parameters = @{ tagName = 'CostCenter' }
}
PolicyDefinition @{
Id = '9798d31d-6028-4dee-8643-46102185c016'
ReferenceId = 'BackupVaultSoftDelete'
Version = '1.*.*-preview'
Group = 'SoftDelete', 'Backup & Recoverability'
Parameters = [ordered]@{ effect = 'Audit'; checkAlwaysOnSoftDeleteOnly = $true }
}
- A member by
-Idhas no name, so all its options go in the hashtable. Most long members are built-ins by-Id, since an ID takes up much of the line. - The hashtable's values are checked as named parameters would be: strings, a list of names for
Group, and a hashtable forParameters. The rules for each option are the same in every form. An unknown key, a value of the wrong kind, the name both before the hashtable and inside it, two hashtables, a second argument that isn't a hashtable, or a hashtable together with named options, is BYL1064, which lists the valid keys. ConvertTo-Bylawwrites a member or group in the hashtable form when the one-line form's first line would be longer than 120 characters, counting a member's-Parameters @{. Otherwise it writes the one-line form.- Splatting,
PolicyDefinition @member, still works, because these keywords are PowerShell functions, but it isn't the documented form.
The first version of this ADR left long members to splatting, and ConvertTo-Bylaw wrote a variable for each long member, named after its reference ID, such as $member6BackupEnableSoftDeleteBackUpVaults, then PolicyDefinition @member6BackupEnableSoftDeleteBackUpVaults. Groups had no way to break a long line, so a group with a long name, display name and description converted to one line of 150 characters or more. The options considered were:
- A hashtable after the name, as
Parametertakes (chosen). One form for every keyword's long declarations, with the options next to the keyword. Keys are checked by Bylaw, with a message that lists the valid ones. It costs each keyword a check of the hashtable's values, which PowerShell's parameter binding does for named options. The checks are shared by a helper,Resolve-BylawOptionTable, which other keywords can use. - Splatting from a variable. PowerShell has no inline splatting:
PolicyDefinition @{ ... }passes the hashtable as an argument, not as named options, so a splat needs a variable. Each member then takes two statements, and a generated variable name, away from the keyword it belongs to. A misspelled key is a PowerShell binding error rather than a Bylaw diagnostic, and ADR-0047's restricted mode doesn't allow splatting, so converted initiatives couldn't be compiled in it. - Backtick line continuation. Bylaw files don't use it (SPEC.md): a space after a backtick silently ends the statement.
Other keywords that make long lines may take the same form. In the files ConvertTo-Bylaw makes from the Azure Landing Zones Library, the keywords with the most lines over 120 characters, after PolicyDefinition, are DeployIfNotExists and Deployment. Deployment takes the form too, with the hashtable as its only argument, since it has no name (ADR-0031). DeployIfNotExists and AuditIfNotExists are left for their own decision: they already take a type and a block as positional arguments, so a hashtable between them changes how their arguments are read. The other long lines are long values, such as descriptions, Arm expressions and -BeIn lists, which a hashtable wouldn't shorten.
Consequences¶
- Good, because initiatives and policies are written the same way, in the same files, and checked together.
- Good, because a long member or group is one statement in the hashtable form
Parameteruses, with its keys checked. - Good, because built-in members, most members in practice, need only an ID.
- Bad, because a built-in member's parameters can't be checked offline: Bylaw has no snapshot of built-in definitions. ADR-0034 explains what is checked.
Confirmation¶
Unit tests cover each keyword, option and error, in the named and hashtable forms, references to policies in the same file and in other files, built-in members, repeated members, versions and groups. Golden tests cover an initiative in EPAC and plain JSON.
Pros and Cons of the Options¶
Initiative with PolicyDefinition¶
- Good, because it reads like the rest of the language, and each member's options are validated.
- Bad, because it adds a top-level keyword.
A hashtable or data file¶
- Good, because an initiative is mostly data.
- Bad, because parameters, versions and groups would be untyped, and errors would have no source location in the DSL.
Policy -Initiative¶
- Good, because a policy says which initiatives it is in.
- Bad, because built-in members have no
Policyblock, and initiative parameters and groups would have nowhere to go.