Skip to content

Initiative

SYNOPSIS

Declares one Azure Policy initiative (policy set definition).

SYNTAX

Initiative [-Name] <String> [-Body] <ScriptBlock> [<CommonParameters>]

DESCRIPTION

A top-level Bylaw DSL command, like Policy (ADR-0033). The scriptblock uses the inner keywords Properties, Parameter, PolicyDefinition and DefinitionGroup, with Param, Arm and ResourceGroupTag for values. They exist only while the block runs.

Members are policies from the same build, by name, or other definitions by ID. Members from the build are checked against the compiled policies once every file has compiled (ADR-0034).

USED IN

The top level of a .bylaw.ps1 file

EXAMPLES

Example 1

Initiative 'tagging-baseline' {
    Properties @{ DisplayName = 'Tagging baseline'; Category = 'Tags'; Version = '1.0.0' }
    Parameter Effect -AllowedValues Audit, Deny, Disabled -Default Audit
    PolicyDefinition 'tags-require-mandatory-tags' -Parameters @{ effect = Param Effect }
}

PARAMETERS

-Name

The definition name. It is the initiative's identity and output file name, so renaming it creates a new initiative. The same rule as for Policy names applies (ADR-0010), and names are unique across the policies and initiatives in a build.

Type: String
Required: true
Position: 1
Accept pipeline input: false

-Body

The initiative description.

Type: ScriptBlock
Required: true
Position: 2
Accept pipeline input: false