Each¶
SYNOPSIS¶
Every element of an array must satisfy the block. Compiles to count/where (ADR-0002).
SYNTAX¶
Each [-Path] <String> [-Body] <ScriptBlock> [<CommonParameters>]
DESCRIPTION¶
Field names inside Each are relative to the element, and Element is the element itself when the array holds plain values. A missing or empty array is compliant, as in Azure. Inside Each, a missing field on an element is compliant unless -Strict is used on Must.
USED IN¶
Require, Each, AnyOf, AllOf
EXAMPLES¶
Example 1¶
Each networkAcls.ipRules[*] {
Field value | Must -Not -Be '0.0.0.0/0'
}
Example 2¶
Each accessPolicies[*] {
Each permissions.keys[*] {
Element | Must -Not -Be 'purge'
}
}
PARAMETERS¶
-Path¶
The array, ending in [], e.g. networkAcls.ipRules[]. Inside another Each, it is relative to that element.
Type: String
Required: true
Position: 1
Accept pipeline input: false
-Body¶
The requirement every element must meet.
Type: ScriptBlock
Required: true
Position: 2
Accept pipeline input: false