Skip to content

Commit da95f11

Browse files
authored
Merge pull request #115175 from DCtheGeek/dmc-policy-samplesparameters
Add Parameters pattern #3 - Effect
2 parents b2206fb + 8f60400 commit da95f11

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

articles/governance/policy/samples/pattern-parameters.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Pattern: Parameters in a policy definition"
33
description: This Azure Policy pattern provides an example of how to use parameters in a policy definition.
4-
ms.date: 01/31/2020
4+
ms.date: 05/20/2020
55
ms.topic: sample
66
---
77
# Azure Policy pattern: parameters
@@ -52,6 +52,26 @@ Here, it's used against the **serviceProvider.bandwidthInMbps** alias as one of
5252

5353
:::code language="json" source="~/policy-templates/patterns/pattern-parameters-2.json" range="21-24" highlight="3":::
5454

55+
## Sample 3: Parameterized effect
56+
57+
A common way to make policy definitions reusable is to parameterize the effect itself. This example
58+
uses a single parameter, **effect**. Parameterizing the effect makes it possible to assign the same
59+
definition to different scopes with different effects.
60+
61+
:::code language="json" source="~/policy-templates/patterns/pattern-parameters-3.json":::
62+
63+
### Sample 3: Explanation
64+
65+
:::code language="json" source="~/policy-templates/patterns/pattern-parameters-3.json" range="11-25":::
66+
67+
In this portion of the policy definition, the **effect** parameter is defined as _string_. The
68+
policy definition sets the default value for an assignment to _audit_ and limits the other options
69+
to _disabled_ and _deny_.
70+
71+
The parameter is then used in the **policyRule.then** block for the _effect_.
72+
73+
:::code language="json" source="~/policy-templates/patterns/pattern-parameters-3.json" range="38-40" highlight="2":::
74+
5575
## Next steps
5676

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

0 commit comments

Comments
 (0)