Skip to content

When

SYNOPSIS

Applicability conditions. Emitted as written; not inverted (ADR-0002).

SYNTAX

When [-Body] <ScriptBlock> [<CommonParameters>]

DESCRIPTION

When narrows the resources the policy applies to: only resources that meet every statement in it are checked against the Require blocks. Unlike Require, it is emitted as written and gets no missing-field checks, so -IfPresent and -Strict can't be used in it.

USED IN

Resource

EXAMPLES

Example 1

When {
    Field networkAcls.defaultAction | Must -Be 'Deny'
}

PARAMETERS

-Body

The statements a resource must meet for the policy to apply to it.

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