Skip to content

Commit b15ac77

Browse files
authored
Merge pull request #94551 from DCtheGeek/dmc-policy-fixesfromcm
Fixes from @camillemarie
2 parents 24aa449 + dca41eb commit b15ac77

File tree

1 file changed

+21
-50
lines changed

1 file changed

+21
-50
lines changed

articles/governance/policy/concepts/definition-structure.md

Lines changed: 21 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,7 @@ would be used by each assignment of the policy definition to limit the accepted
170170

171171
### Using a parameter value
172172

173-
In the policy rule, you reference parameters with the following `parameters` deployment value
174-
function syntax:
173+
In the policy rule, you reference parameters with the following `parameters` function syntax:
175174

176175
```json
177176
{
@@ -330,7 +329,7 @@ The following fields are supported:
330329
- This bracket syntax supports tag names that have apostrophes in it by escaping with double
331330
apostrophes.
332331
- Where **'\<tagName\>'** is the name of the tag to validate the condition for.
333-
- Example: `tags['''My.Apostrophe.Tag''']` where **'\<tagName\>'** is the name of the tag.
332+
- Example: `tags['''My.Apostrophe.Tag''']` where **'My.Apostrophe.Tag'** is the name of the tag.
334333
- property aliases - for a list, see [Aliases](#aliases).
335334

336335
> [!NOTE]
@@ -343,7 +342,7 @@ A parameter value can be passed to a tag field. Passing a parameter to a tag fie
343342
flexibility of the policy definition during policy assignment.
344343

345344
In the following example, `concat` is used to create a tags field lookup for the tag named the
346-
value of the **tagName** parameter. If that tag doesn't exist, the **append** effect is used to add
345+
value of the **tagName** parameter. If that tag doesn't exist, the **modify** effect is used to add
347346
the tag using the value of the same named tag set on the audited resources parent resource group by
348347
using the `resourcegroup()` lookup function.
349348

@@ -354,11 +353,17 @@ using the `resourcegroup()` lookup function.
354353
"exists": "false"
355354
},
356355
"then": {
357-
"effect": "append",
358-
"details": [{
359-
"field": "[concat('tags[', parameters('tagName'), ']')]",
360-
"value": "[resourcegroup().tags[parameters('tagName')]]"
361-
}]
356+
"effect": "modify",
357+
"details": {
358+
"operations": [{
359+
"operation": "add",
360+
"field": "[concat('tags[', parameters('tagName'), ']')]",
361+
"value": "[resourcegroup().tags[parameters('tagName')]]"
362+
}],
363+
"roleDefinitionIds": [
364+
"/providers/microsoft.authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c"
365+
]
366+
}
362367
}
363368
}
364369
```
@@ -471,51 +476,17 @@ Azure Policy supports the following types of effect:
471476

472477
- **Append**: adds the defined set of fields to the request
473478
- **Audit**: generates a warning event in activity log but doesn't fail the request
474-
- **AuditIfNotExists**: enables auditing if a resource doesn't exist
479+
- **AuditIfNotExists**: generates a warning event in activity log if a related resource doesn't
480+
exist
475481
- **Deny**: generates an event in the activity log and fails the request
476-
- **DeployIfNotExists**: deploys a resource if it doesn't already exist
482+
- **DeployIfNotExists**: deploys a related resource if it doesn't already exist
477483
- **Disabled**: doesn't evaluate resources for compliance to the policy rule
478-
- **EnforceOPAConstraint**: configures the Open Policy Agent admissions controller with Gatekeeper
479-
v3 for self-managed Kubernetes clusters on Azure (preview)
480-
- **EnforceRegoPolicy**: configures the Open Policy Agent admissions controller with Gatekeeper v2
481-
in Azure Kubernetes Service (preview)
484+
- **EnforceOPAConstraint** (preview): configures the Open Policy Agent admissions controller with
485+
Gatekeeper v3 for self-managed Kubernetes clusters on Azure (preview)
486+
- **EnforceRegoPolicy** (preview): configures the Open Policy Agent admissions controller with
487+
Gatekeeper v2 in Azure Kubernetes Service
482488
- **Modify**: adds, updates, or removes the defined tags from a resource
483489

484-
For **append**, you must provide the following details:
485-
486-
```json
487-
"effect": "append",
488-
"details": [{
489-
"field": "field name",
490-
"value": "value of the field"
491-
}]
492-
```
493-
494-
The value can be either a string or a JSON format object.
495-
496-
**AuditIfNotExists** and **DeployIfNotExists** evaluate the existence of a related resource and
497-
apply a rule. If the resource doesn't match the rule, the effect is implemented. For example, you
498-
can require that a network watcher is deployed for all virtual networks. For more information, see
499-
the [Audit if extension doesn't exist](../samples/audit-ext-not-exist.md) example.
500-
501-
The **DeployIfNotExists** effect requires the **roleDefinitionId** property in the **details**
502-
portion of the policy rule. For more information, see [Remediation - Configure policy
503-
definition](../how-to/remediate-resources.md#configure-policy-definition).
504-
505-
```json
506-
"details": {
507-
...
508-
"roleDefinitionIds": [
509-
"/subscription/{subscriptionId}/providers/Microsoft.Authorization/roleDefinitions/{roleGUID}",
510-
"/providers/Microsoft.Authorization/roleDefinitions/{builtinroleGUID}"
511-
]
512-
}
513-
```
514-
515-
Similarly, **Modify** requires **roleDefinitionId** property in the **details** portion of the
516-
policy rule for the [remediation task](../how-to/remediate-resources.md). **Modify** also requires
517-
an **operations** array to define what actions to take on the resources tags.
518-
519490
For complete details on each effect, order of evaluation, properties, and examples, see
520491
[Understanding Azure Policy Effects](effects.md).
521492

0 commit comments

Comments
 (0)