Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates to schemas #869

Merged
merged 1 commit into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions Docs/operational-scripts-documenting-policy.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,17 @@ To utilize the schema add a ```$schema``` tag to the JSON file.

This schema is new in v7.4.x and may not be complete. Please let us know if we missed anything.

## Example Documentation Specification File using 'documentAllAssignments'
## Examples

Each file must contain one or both documentation topics. This example file in the StarterKit has both topics. The element `pacEnvironment` references the Policy as Code environment in `global-settings.jsonc` defining the tenant and root scope where the custom Policies and Policy Sets are deployed.
The following are 2 examples which are both valid. Both are presented and should be used based on requirements and preference.

* [`documentAssignments`](#assignment-documentation)
* [`documentPolicySets`](#policy-set-documentation)
### Document All Assignments

Each file must contain one or both documentation topics, [`documentAssignments`](#assignment-documentation) and/or [`documentPolicySets`](#policy-set-documentation). This example file in the StarterKit has both topics. The element `pacEnvironment` references the Policy as Code environment in `global-settings.jsonc` defining the tenant and root scope where the custom Policies and Policy Sets are deployed.

```json
{
"$schema": "https://raw.githubusercontent.com/Azure/enterprise-azure-policy-as-code/main/Schemas/policy-documentation-schema.json",
"documentAssignments": {
"documentAllAssignments": [
{
Expand Down Expand Up @@ -104,15 +106,16 @@ Each file must contain one or both documentation topics. This example file in th
}
```

## Example Documentation Specification File using 'environmentCategories'
### Document chosen 'Environment Categories'

Each file must contain one or both documentation topics. This example file in the StarterKit has both topics. The element `pacEnvironment` references the Policy as Code environment in `global-settings.jsonc` defining the tenant and root scope where the custom Policies and Policy Sets are deployed.
Each file must contain one or both documentation topics, [`documentAssignments`](#assignment-documentation) and/or [`documentPolicySets`](#policy-set-documentation). This example file in the StarterKit has both topics. The element `pacEnvironment` references the Policy as Code environment in `global-settings.jsonc` defining the tenant and root scope where the custom Policies and Policy Sets are deployed.

* [`documentAssignments`](#assignment-documentation)
* [`documentPolicySets`](#policy-set-documentation)

```json
{
"$schema": "https://raw.githubusercontent.com/Azure/enterprise-azure-policy-as-code/main/Schemas/policy-documentation-schema.json",
"documentAssignments": {
"environmentCategories": [
{
Expand Down
31 changes: 20 additions & 11 deletions Schemas/policy-documentation-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"properties": {
"documentAllAssignments": {
"type": "array",
"maxItems": 1,
"minItems": 1,
"items": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -99,12 +99,6 @@
}
},
"anyOf": [
{
"required": [
"environmentCategories",
"documentationSpecifications"
]
},
{
"required": [
"documentAllAssignments",
Expand Down Expand Up @@ -138,12 +132,27 @@
"type": "string"
},
"id": {
"type": "string"
"type": "string",
"description": "The name of the policy set. This is used for built-in policy sets."
},
"name": {
"type": "string",
"description": "The name of the policy set. This is used for custom policy sets."
}
},
"required": [
"shortName",
"id"
"oneOf": [
{
"required": [
"shortName",
"id"
]
},
{
"required": [
"shortName",
"name"
]
}
]
}
},
Expand Down
3 changes: 3 additions & 0 deletions Schemas/policy-set-definition-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
"displayName": {
"type": "string"
},
"policyType": {
"type": "string"
},
"description": {
"type": "string"
},
Expand Down