Skip to content

Commit 1af1b97

Browse files
committed
Clarified that the remove operation is only for tags. Began adding details about when evalutaion skips modify.
1 parent b7f421e commit 1af1b97

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

articles/governance/policy/concepts/effect-modify.md

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ The `modify` effect is used to add, update, or remove properties or tags on a su
1111

1212
The `modify` effect supports the following operations:
1313

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.
1717
- 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`.
1818

1919
> [!IMPORTANT]
@@ -24,9 +24,9 @@ The `modify` effect supports the following operations:
2424
2525
## Modify evaluation
2626

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.
2828

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:
3030

3131
- The property the alias maps to is marked as **Modifiable** in the request's API version.
3232
- 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
3939
> same alias behaves differently between API versions, conditional modify operations can be used to
4040
> determine the `modify` operation used for each API version.
4141
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+
4247
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.
4348

4449
## Modify properties
@@ -59,7 +64,9 @@ The `details` property of the `modify` effect has all the subproperties that def
5964
- An array of all tag operations to be completed on matching resources.
6065
- Properties:
6166
- `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.
6370
- `field` (required)
6471
- 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).
6572
- `value` (optional)
@@ -106,7 +113,7 @@ The `operation` property has the following options:
106113
|-|-|
107114
| `addOrReplace` | Adds the defined property or tag and value to the resource, even if the property or tag already exists with a different value. |
108115
| `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. |
110117

111118
## Modify examples
112119

@@ -184,4 +191,4 @@ Example 3: Ensure that a storage account doesn't allow blob public access, the `
184191
- Understand how to [programmatically create policies](../how-to/programmatically-create.md).
185192
- Learn how to [get compliance data](../how-to/get-compliance-data.md).
186193
- Learn how to [remediate non-compliant resources](../how-to/remediate-resources.md).
187-
- Review [Azure management groups](../../management-groups/overview.md).
194+
- Review [Azure management groups](../../management-groups/overview.md).

0 commit comments

Comments
 (0)