Skip to content

Commit 313162d

Browse files
committed
Add sample to logical operators pattern
1 parent 4c3fc2f commit 313162d

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

articles/governance/policy/samples/pattern-logical-operators.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Pattern: Logical operators in a policy definition"
33
description: This Azure Policy pattern provides examples of how to use the logical operators in a policy definition.
4-
ms.date: 01/31/2020
4+
ms.date: 04/15/2020
55
ms.topic: sample
66
---
77
# Azure Policy pattern: logical operators
@@ -42,6 +42,22 @@ the **not** logical operator. The conditional inside the **not** logical operato
4242
and then evaluates the **not** to determine if the entire clause is true or false. If both **not**
4343
logical operators evaluate to true, the policy effect triggers.
4444

45+
## Sample 3: Combining logical operators
46+
47+
This policy definition evaluates Java Spring accounts to see if either trace isn't enabled or if
48+
trace isn't in a successful state.
49+
50+
:::code language="json" source="~/policy-templates/patterns/pattern-logical-operators-3.json":::
51+
52+
### Sample 3: Explanation
53+
54+
:::code language="json" source="~/policy-templates/patterns/pattern-logical-operators-3.json" range="6-28" highlight="3,8":::
55+
56+
This **policyRule.if** block includes both the **allOf** and **anyOf** logical operators. The
57+
**anyOf** logical operator evaluates true as long as one included condition is true. As the _type_
58+
is at the core of the **allOf**, it must always evaluate true. If the _type_ and one of the
59+
conditions in the **anyOf** are true, the policy effect triggers.
60+
4561
## Next steps
4662

4763
- Review other [patterns and built-in definitions](./index.md).

0 commit comments

Comments
 (0)