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
Copy file name to clipboardExpand all lines: articles/governance/policy/concepts/effect-modify.md
+15-8Lines changed: 15 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,9 +11,9 @@ The `modify` effect is used to add, update, or remove properties or tags on a su
11
11
12
12
The `modify` effect supports the following operations:
13
13
14
-
-Add, replace, or remove resource tags. For tags, a Modify policy should have [mode](./definition-structure.md#resource-manager-modes) set to `indexed` unless the target resource is a resource group.
15
-
-Add or replace the value of managed identity type (`identity.type`) of virtual machines and Virtual Machine Scale Sets. You can only modify the `identity.type` for virtual machines or Virtual Machine Scale Sets.
16
-
-Add or replace the values of certain aliases.
14
+
-_Add_, _replace_, or _remove_ resource tags. Only tags can be removed. For tags, a Modify policy should have [mode](./definition-structure.md#resource-manager-modes) set to `indexed` unless the target resource is a resource group.
15
+
-_Add_ or _replace_ the value of managed identity type (`identity.type`) of virtual machines and Virtual Machine Scale Sets. You can only modify the `identity.type` for virtual machines or Virtual Machine Scale Sets.
16
+
-_Add_ or _replace_ the values of certain aliases.
17
17
- Use `Get-AzPolicyAlias | Select-Object -ExpandProperty 'Aliases' | Where-Object { $_.DefaultMetadata.Attributes -eq 'Modifiable' }` in Azure PowerShell **4.6.0** or higher to get a list of aliases that can be used with `modify`.
18
18
19
19
> [!IMPORTANT]
@@ -24,9 +24,9 @@ The `modify` effect supports the following operations:
24
24
25
25
## Modify evaluation
26
26
27
-
Modify evaluates before the request gets processed by a Resource Provider during the creation or updating of a resource. The `modify` operations are applied to the request content when the `if` condition of the policy rule is met. Each `modify` operation can specify a condition that determines when it's applied. Operations with _false_ condition evaluations are skipped.
27
+
Modify evaluates before the request gets processed by a Resource Provider during the creation or updating of a resource. The `modify` operations are applied to the request content when the `if` condition of the policy rule is met. Each `modify` operation can specify a condition that determines when it's applied.
28
28
29
-
When an alias is specified, the more checks are performed to ensure that the `modify` operation doesn't change the request content in a way that causes the resource provider to reject it:
29
+
When an alias is specified, more checks are performed to ensure that the `modify` operation doesn't change the request content in a way that causes the resource provider to reject it:
30
30
31
31
- The property the alias maps to is marked as **Modifiable** in the request's API version.
32
32
- The token type in the `modify` operation matches the expected token type for the property in the request's API version.
@@ -39,6 +39,11 @@ If either of these checks fail, the policy evaluation falls back to the specifie
39
39
> same alias behaves differently between API versions, conditional modify operations can be used to
40
40
> determine the `modify` operation used for each API version.
41
41
42
+
There are some cases when modify operations are skipped during evaluation. This occurs when:
43
+
- The operations condition is evaluated to _false_.
44
+
- The alias is not modifiable in the request's API version. If the conflict effect is set to _deny_ the request will be blocked. If the conflict effect is set to _audit_ the request will be allowed through but the modify operation will be skipped.
45
+
-[LEFT OFF HERE]
46
+
42
47
When a policy definition using the `modify` effect is run as part of an evaluation cycle, it doesn't make changes to resources that already exist. Instead, it marks any resource that meets the `if` condition as non-compliant.
43
48
44
49
## Modify properties
@@ -59,7 +64,9 @@ The `details` property of the `modify` effect has all the subproperties that def
59
64
- An array of all tag operations to be completed on matching resources.
60
65
- Properties:
61
66
-`operation` (required)
62
-
- Defines what action to take on a matching resource. Options are: _addOrReplace_, _Add_, _Remove_. _Add_ behaves similar to the [append](./effect-append.md) effect.
67
+
- Defines what action to take on a matching resource. Options are: `addOrReplace`, `Add`, and `Remove`.
68
+
-`Add` behaves similar to the [append](./effect-append.md) effect.
69
+
-`Remove` is only supported for resource tags.
63
70
-`field` (required)
64
71
- The tag to add, replace, or remove. Tag names must adhere to the same naming convention for other [fields](./definition-structure-policy-rule.md#fields).
65
72
-`value` (optional)
@@ -106,7 +113,7 @@ The `operation` property has the following options:
106
113
|-|-|
107
114
|`addOrReplace`| Adds the defined property or tag and value to the resource, even if the property or tag already exists with a different value. |
108
115
|`add`| Adds the defined property or tag and value to the resource. |
109
-
|`remove`| Removes the defined property or tag from the resource. |
116
+
|`remove`| Removes the defined tag from the resource. Only supported for tags. |
110
117
111
118
## Modify examples
112
119
@@ -184,4 +191,4 @@ Example 3: Ensure that a storage account doesn't allow blob public access, the `
184
191
- Understand how to [programmatically create policies](../how-to/programmatically-create.md).
185
192
- Learn how to [get compliance data](../how-to/get-compliance-data.md).
186
193
- Learn how to [remediate non-compliant resources](../how-to/remediate-resources.md).
0 commit comments