Skip to content

Commit 686e6f3

Browse files
Merge pull request #48701 from pilor/patch-9
Add requestContext()
2 parents dd3db8d + 89b69bc commit 686e6f3

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

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

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -692,18 +692,24 @@ use within a policy rule, except the following functions and user-defined functi
692692
The following functions are available to use in a policy rule, but differ from use in an Azure
693693
Resource Manager template:
694694

695-
- addDays(dateTime, numberOfDaysToAdd)
695+
- `addDays(dateTime, numberOfDaysToAdd)`
696696
- **dateTime**: [Required] string - String in the Universal ISO 8601 DateTime format
697697
'yyyy-MM-ddTHH:mm:ss.fffffffZ'
698698
- **numberOfDaysToAdd**: [Required] integer - Number of days to add
699-
- utcNow() - Unlike a Resource Manager template, this can be used outside defaultValue.
699+
- `utcNow()` - Unlike a Resource Manager template, this can be used outside defaultValue.
700700
- Returns a string that is set to the current date and time in Universal ISO 8601 DateTime format
701701
'yyyy-MM-ddTHH:mm:ss.fffffffZ'
702702

703-
Additionally, the `field` function is available to policy rules. `field` is primarily used with
704-
**AuditIfNotExists** and **DeployIfNotExists** to reference fields on the resource that are being
705-
evaluated. An example of this use can be seen in the [DeployIfNotExists
706-
example](effects.md#deployifnotexists-example).
703+
The following functions are only available in policy rules:
704+
705+
- `field(fieldName)`
706+
- **fieldName**: [Required] string - Name of the [field](#fields) to retrieve
707+
- Returns the value of that field from the resource that is being evaluated by the If condition
708+
- `field` is primarily used with **AuditIfNotExists** and **DeployIfNotExists** to reference fields on the resource that are being evaluated. An example of this use can be seen in the [DeployIfNotExists example](effects.md#deployifnotexists-example).
709+
- `requestContext().apiVersion`
710+
- Returns the API version of the request that triggered policy evaluation (example: `2019-09-01`). This will be the API version that was used in the PUT/PATCH request for evaluations on resource creation/update. The latest API version is always used during compliance evaluation on existing resources.
711+
712+
707713

708714
#### Policy function example
709715

0 commit comments

Comments
 (0)