@@ -170,8 +170,7 @@ would be used by each assignment of the policy definition to limit the accepted
170
170
171
171
### Using a parameter value
172
172
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:
175
174
176
175
``` json
177
176
{
@@ -330,7 +329,7 @@ The following fields are supported:
330
329
- This bracket syntax supports tag names that have apostrophes in it by escaping with double
331
330
apostrophes.
332
331
- 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.
334
333
- property aliases - for a list, see [ Aliases] ( #aliases ) .
335
334
336
335
> [ !NOTE]
@@ -343,7 +342,7 @@ A parameter value can be passed to a tag field. Passing a parameter to a tag fie
343
342
flexibility of the policy definition during policy assignment.
344
343
345
344
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
347
346
the tag using the value of the same named tag set on the audited resources parent resource group by
348
347
using the ` resourcegroup() ` lookup function.
349
348
@@ -354,11 +353,17 @@ using the `resourcegroup()` lookup function.
354
353
"exists" : " false"
355
354
},
356
355
"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
+ }
362
367
}
363
368
}
364
369
```
@@ -471,51 +476,17 @@ Azure Policy supports the following types of effect:
471
476
472
477
- ** Append** : adds the defined set of fields to the request
473
478
- ** 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
475
481
- ** 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
477
483
- ** 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
482
488
- ** Modify** : adds, updates, or removes the defined tags from a resource
483
489
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
-
519
490
For complete details on each effect, order of evaluation, properties, and examples, see
520
491
[ Understanding Azure Policy Effects] ( effects.md ) .
521
492
0 commit comments