You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The original paragraph introduced three different scenarios that use the [*] alias field condition, but it never came back and explained which one is which one.
Being no expert on logical statements, it took me some time to bite through, and when I did, I felt like I would pass this on. :)
Copy file name to clipboardExpand all lines: articles/governance/policy/how-to/author-policies-for-arrays.md
+14-13Lines changed: 14 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -163,8 +163,9 @@ expression. To resolve this error message, change `equals` to either `in` or `no
163
163
164
164
Aliases that have **\[\*\]** attached to their name indicate the **type** is an _array_. Instead of
165
165
evaluating the value of the entire array, **\[\*\]** makes it possible to evaluate each element of
166
-
the array. There are three standard scenarios this per item evaluation is useful in: None, Any, and
167
-
All. For complex scenarios, use [count](../concepts/definition-structure.md#count).
166
+
the array individually, with logical AND between them. There are three standard scenarios this per
167
+
item evaluation is useful in: _None_, _Any_, or _All_ elements match.
168
+
For complex scenarios, use [count](../concepts/definition-structure.md#count).
168
169
169
170
The policy engine triggers the **effect** in **then** only when the **if** rule evaluates as true.
170
171
This fact is important to understand in context of the way **\[\*\]** evaluates each individual
@@ -209,16 +210,16 @@ For each condition example below, replace `<field>` with `"field": "Microsoft.St
209
210
The following outcomes are the result of the combination of the condition and the example policy
210
211
rule and array of existing values above:
211
212
212
-
|Condition |Outcome |Explanation |
213
-
|-|-|-|
214
-
|`{<field>,"notEquals":"127.0.0.1"}`|Nothing |One array element evaluates as false (127.0.0.1 != 127.0.0.1) and one as true (127.0.0.1 != 192.168.1.1), so the **notEquals** condition is _false_ and the effect isn't triggered. |
215
-
|`{<field>,"notEquals":"10.0.4.1"}`|Policy effect |Both array elements evaluate as true (10.0.4.1 != 127.0.0.1 and 10.0.4.1 != 192.168.1.1), so the **notEquals** condition is _true_ and the effect is triggered. |
216
-
|`"not":{<field>,"Equals":"127.0.0.1"}`|Policy effect |One array element evaluates as true (127.0.0.1 == 127.0.0.1) and one as false (127.0.0.1 == 192.168.1.1), so the **Equals** condition is _false_. The logical operator evaluates as true (**not**_false_), so the effect is triggered. |
217
-
|`"not":{<field>,"Equals":"10.0.4.1"}`|Policy effect |Both array elements evaluate as false (10.0.4.1 == 127.0.0.1 and 10.0.4.1 == 192.168.1.1), so the **Equals** condition is _false_. The logical operator evaluates as true (**not**_false_), so the effect is triggered. |
218
-
|`"not":{<field>,"notEquals":"127.0.0.1"}`|Policy effect |One array element evaluates as false (127.0.0.1 != 127.0.0.1) and one as true (127.0.0.1 != 192.168.1.1), so the **notEquals** condition is _false_. The logical operator evaluates as true (**not**_false_), so the effect is triggered. |
219
-
|`"not":{<field>,"notEquals":"10.0.4.1"}`|Nothing |Both array elements evaluate as true (10.0.4.1 != 127.0.0.1 and 10.0.4.1 != 192.168.1.1), so the **notEquals** condition is _true_. The logical operator evaluates as false (**not**_true_), so the effect isn't triggered. |
220
-
|`{<field>,"Equals":"127.0.0.1"}`|Nothing |One array element evaluates as true (127.0.0.1 == 127.0.0.1) and one as false (127.0.0.1 == 192.168.1.1), so the **Equals** condition is _false_ and the effect isn't triggered. |
221
-
|`{<field>,"Equals":"10.0.4.1"}`|Nothing |Both array elements evaluate as false (10.0.4.1 == 127.0.0.1 and 10.0.4.1 == 192.168.1.1), so the **Equals** condition is _false_ and the effect isn't triggered. |
213
+
|Condition |Outcome | Scenario |Explanation |
214
+
|-|-|-|-|
215
+
|`{<field>,"notEquals":"127.0.0.1"}`|Nothing |None match |One array element evaluates as false (127.0.0.1 != 127.0.0.1) and one as true (127.0.0.1 != 192.168.1.1), so the **notEquals** condition is _false_ and the effect isn't triggered. |
216
+
|`{<field>,"notEquals":"10.0.4.1"}`|Policy effect |None match |Both array elements evaluate as true (10.0.4.1 != 127.0.0.1 and 10.0.4.1 != 192.168.1.1), so the **notEquals** condition is _true_ and the effect is triggered. |
217
+
|`"not":{<field>,"notEquals":"127.0.0.1"}`|Policy effect |One or more match |One array element evaluates as false (127.0.0.1 != 127.0.0.1) and one as true (127.0.0.1 != 192.168.1.1), so the **notEquals** condition is _false_. The logical operator evaluates as true (**not**_false_), so the effect is triggered. |
218
+
|`"not":{<field>,"notEquals":"10.0.4.1"}`|Nothing |One or more match |Both array elements evaluate as true (10.0.4.1 != 127.0.0.1 and 10.0.4.1 != 192.168.1.1), so the **notEquals** condition is _true_. The logical operator evaluates as false (**not**_true_), so the effect isn't triggered. |
219
+
|`"not":{<field>,"Equals":"127.0.0.1"}`|Policy effect |Not all match |One array element evaluates as true (127.0.0.1 == 127.0.0.1) and one as false (127.0.0.1 == 192.168.1.1), so the **Equals** condition is _false_. The logical operator evaluates as true (**not**_false_), so the effect is triggered. |
220
+
|`"not":{<field>,"Equals":"10.0.4.1"}`|Policy effect |Not all match |Both array elements evaluate as false (10.0.4.1 == 127.0.0.1 and 10.0.4.1 == 192.168.1.1), so the **Equals** condition is _false_. The logical operator evaluates as true (**not**_false_), so the effect is triggered. |
221
+
|`{<field>,"Equals":"127.0.0.1"}`|Nothing |All match |One array element evaluates as true (127.0.0.1 == 127.0.0.1) and one as false (127.0.0.1 == 192.168.1.1), so the **Equals** condition is _false_ and the effect isn't triggered. |
222
+
|`{<field>,"Equals":"10.0.4.1"}`|Nothing |All match |Both array elements evaluate as false (10.0.4.1 == 127.0.0.1 and 10.0.4.1 == 192.168.1.1), so the **Equals** condition is _false_ and the effect isn't triggered. |
222
223
223
224
## The append effect and arrays
224
225
@@ -238,4 +239,4 @@ For more information, see the [append examples](../concepts/effects.md#append-ex
0 commit comments