|
| 1 | +# Documenting Assignments and Initiatives |
| 2 | + |
| 3 | +## Table of Contents |
| 4 | + |
| 5 | +- [Documentation Specification Files](#documentation-specification-files) |
| 6 | +- [Example File](#example-documentation-specification-file) |
| 7 | +- [Specifying Assignment Documentation](#specifying-assignment-documentation) |
| 8 | +- [Specifying Initiative Documentation](#specifying-initiative-documentation) |
| 9 | +- [Reading List](#reading-list) |
| 10 | + |
| 11 | +## Overview |
| 12 | + |
| 13 | +The names of the definition Json files don't matter. reads any file in the folder with a `.json` and `.jsonc` extension. |
| 14 | + |
| 15 | +Script [`./Scripts/Operations/Build-PolicyAssignmentDocumentation.ps1`](../../Scripts/Operations/README.md#build-policyassignmentdocumentationps1) documents Initiatives and Assignments in your environment. It retrieves its instruction from Json files in this folder. |
| 16 | + |
| 17 | +- Read and process Policy Assignments representative of an environment category, such as PROD, DEV, SANDBOX. It generates Markdown and as Excel csv files. |
| 18 | +- Read and process Initiative definitions to compare them for Policy and effect overlap. It generates Markdown and as Excel csv files. Additionaly, it generates a Json file (`.jsonc`) defining all the parameters for the union of Policies in the Initiatives. This Json file is useful when writting assignment files to copy/paste/modify the parameter values. |
| 19 | + |
| 20 | +<br/> |
| 21 | + |
| 22 | +## Example Documentation Specification File |
| 23 | + |
| 24 | +Each file must contain one or both documentation topics. This example file has both topics. Element `pacEnvironment` references the Policy as Code environment in `global-settings.jsonc` defining the tenant and root scope where the Policy and Initiative definitions are deployed. |
| 25 | + |
| 26 | +- [`documentAssignments`](#specifying-assignment-documentation) |
| 27 | +- [`documentInitiatives`](#specifying-initiative-documentation) |
| 28 | + |
| 29 | +<br/> |
| 30 | + |
| 31 | +```jsonc |
| 32 | +{ |
| 33 | + "documentAssignments": { |
| 34 | + "environmentCategories": [ |
| 35 | + { |
| 36 | + "pacEnvironment": "tenant1", |
| 37 | + "environmentCategory": "PROD", |
| 38 | + "scopes": [ // Used in Markdown output only |
| 39 | + "Management Groups: Contoso-Prod" |
| 40 | + ], |
| 41 | + "representativeAssignments": [ |
| 42 | + { |
| 43 | + "shortName": "ASB", |
| 44 | + "id": "/providers/Microsoft.Management/managementGroups/Contoso-Prod/providers/Microsoft.Authorization/policyAssignments/prod-asb" |
| 45 | + }, |
| 46 | + { |
| 47 | + "shortName": "ORG", |
| 48 | + "id": "/providers/Microsoft.Management/managementGroups/Contoso-Prod/providers/Microsoft.Authorization/policyAssignments/prod-org" |
| 49 | + } |
| 50 | + ] |
| 51 | + }, |
| 52 | + { |
| 53 | + "pacEnvironment": "tenant1", |
| 54 | + "environmentCategory": "NONPROD", |
| 55 | + "scopes": [ // Used in Markdown output only |
| 56 | + "Management Groups: Contoso-NonProd" |
| 57 | + ], |
| 58 | + "representativeAssignments": [ |
| 59 | + { |
| 60 | + "shortName": "ASB", |
| 61 | + "id": "/providers/Microsoft.Management/managementGroups/Contoso-NonProd/providers/Microsoft.Authorization/policyAssignments/prod-asb" |
| 62 | + }, |
| 63 | + { |
| 64 | + "shortName": "ORG", |
| 65 | + "id": "/providers/Microsoft.Management/managementGroups/Contoso-NonProd/providers/Microsoft.Authorization/policyAssignments/prod-org" |
| 66 | + } |
| 67 | + ] |
| 68 | + }, |
| 69 | + { |
| 70 | + "pacEnvironment": "tenant1", |
| 71 | + "environmentCategory": "DEV", |
| 72 | + "scopes": [ // Used in Markdown output only |
| 73 | + "Management Groups: Contoso-Dev" |
| 74 | + ], |
| 75 | + "representativeAssignments": [ |
| 76 | + { |
| 77 | + "shortName": "ASB", |
| 78 | + "id": "/providers/Microsoft.Management/managementGroups/Contoso-Dev/providers/Microsoft.Authorization/policyAssignments/prod-asb" |
| 79 | + }, |
| 80 | + { |
| 81 | + "shortName": "ORG", |
| 82 | + "id": "/providers/Microsoft.Management/managementGroups/Contoso-Dev/providers/Microsoft.Authorization/policyAssignments/prod-org" |
| 83 | + } |
| 84 | + ] |
| 85 | + }, |
| 86 | + ], |
| 87 | + "documentationSpecifications": [ |
| 88 | + { |
| 89 | + "fileNameStem": "contoso-PROD-policy-effects", |
| 90 | + "type": "effectsPerEnvironment", |
| 91 | + "environmentCategory": "PROD", |
| 92 | + "title": "Contoso PROD environments Policy effects" |
| 93 | + }, |
| 94 | + { |
| 95 | + "fileNameStem": "contoso-NONPROD-policy-effects", |
| 96 | + "type": "effectsPerEnvironment", |
| 97 | + "environmentCategory": "NONPROD", |
| 98 | + "title": "Contoso NONPROD environment Policy effects" |
| 99 | + }, |
| 100 | + { |
| 101 | + "fileNameStem": "contoso-DEV-policy-effects", |
| 102 | + "type": "effectsPerEnvironment", |
| 103 | + "environmentCategory": "DEV", |
| 104 | + "title": "Contoso DEV environment Policy effects" |
| 105 | + }, |
| 106 | + { |
| 107 | + "fileNameStem": "contoso-policy-effects-across-environments", |
| 108 | + "type": "effectsAcrossEnvironments", |
| 109 | + "environmentCategories": [ |
| 110 | + "PROD", |
| 111 | + "NONPROD", |
| 112 | + "DEV" |
| 113 | + ], |
| 114 | + "title": "Contoso Policy effects summary" |
| 115 | + } |
| 116 | + ] |
| 117 | + }, |
| 118 | + "documentInitiatives": [ |
| 119 | + { |
| 120 | + "pacEnvironment": "tenant1", |
| 121 | + "fileNameStem": "contoso-compliance-initiatives", |
| 122 | + "title": "Document interesting Initiatives", |
| 123 | + "initiatives": [ |
| 124 | + { |
| 125 | + "shortName": "ASB", |
| 126 | + "id": "/providers/Microsoft.Authorization/policySetDefinitions/1f3afdf9-d0c9-4c3d-847f-89da613e70a8" // Azure Security Benchmark v3 |
| 127 | + }, |
| 128 | + { |
| 129 | + "shortName": "NIST 800-171", |
| 130 | + "id": "/providers/Microsoft.Authorization/policySetDefinitions/03055927-78bd-4236-86c0-f36125a10dc9" // NIST SP 800-171 Rev. 2 |
| 131 | + }, |
| 132 | + { |
| 133 | + "shortName": "NIST 800-53", |
| 134 | + "id": "/providers/Microsoft.Authorization/policySetDefinitions/179d1daa-458f-4e47-8086-2a68d0d6c38f" // NIST SP 800-53 Rev. 5 |
| 135 | + }, |
| 136 | + { |
| 137 | + "shortName": "ORG", |
| 138 | + "id": "/providers/Microsoft.Management/managementGroups/Contoso-Root/providers/Microsoft.Authorization/policySetDefinitions/org-security-benchmark" // Organization Security Benchmark for Custom Policies |
| 139 | + } |
| 140 | + ] |
| 141 | + } |
| 142 | + ] |
| 143 | +} |
| 144 | +``` |
| 145 | + |
| 146 | +<br/> |
| 147 | + |
| 148 | +## Specifying Assignment Documentation |
| 149 | + |
| 150 | +### Element `environmentCategories` |
| 151 | + |
| 152 | +For any given environment category, such as PROD, NONPROD, DEV, this section list Policy Assignment which are representative deployed in thos environments. In many organization, the same Policies and effects are applied to multiple Management Groups and even Azure tenants. |
| 153 | + |
| 154 | +Each `environmentCategories` entry specifies: |
| 155 | + |
| 156 | +- `pacEnvironment`: references the Policy as Code environment in `global-settings.jsonc` defining the tenant and root scope where the Policy and Initiative definitions are deployed. |
| 157 | +- `environmentCategory`: name used for column headings. |
| 158 | +- `scopes`: used in Markdown output only for the Scopes section. |
| 159 | +- `representativeAssignments`: list Policy Assignment `id`s representing this `environmentCategory`. The `shortName` is used for column headings. |
| 160 | + |
| 161 | +<br/> |
| 162 | + |
| 163 | +### Element `documentationSpecifications` |
| 164 | + |
| 165 | +This element defines the outputs. Each entry defines the output of one (1) Markdown and one (1) csv file. |
| 166 | + |
| 167 | +- `fileNameStem`: the file name without the extension (.md, .csv) |
| 168 | +- `type`: two documentation types are supported. |
| 169 | + - `effectsPerEnvironment`: requires a single `environmentCategory` |
| 170 | + - Creates a Markdown file with Policies grouped by effect, sorted by Policy category and display name with effect columns for each Initiative in the representative Assignments. The effective effect is bolded and the other allowed values are listed in the same cell one per line in italics. **No allowed values listed indicate a hard-coded effect.** |
| 171 | + - Creates a csv file with Policies sorted by Policy category and display name with effect columns for each Initiative in the representative Assignments. The effective effect is listed first and the other allowed values are listed in the same cell one per line. |
| 172 | + - `effectsAcrossEnvironments`: compares the most stringent effect from the Assignments across all `environmentCategories` listed as effect columns. |
| 173 | +- `title`: Heading 1 text for Markdown. |
| 174 | + |
| 175 | +<br/> |
| 176 | + |
| 177 | +## Specifying Initiative Documentation |
| 178 | + |
| 179 | +Compares Policy and Initiative definitions to Initiative definitions for Policy and effect overlap as Excel csv files. |
| 180 | + |
| 181 | +Creates a Markdown file with Policies sorted by Policy category and display name with effect columns for each Initiative. The Policy column starts with the bolded display Name followed by the description and lines grouped by bolded Initiative short name with the effect parameter name in italics and the group names in normal text. In the per Initiative effect columns the default effect is bolded and the other allowed values are listed in the same cell one per line in italics. **No allowed values listed indicate a hard-coded effect.** |
| 182 | + |
| 183 | +Create a Json file (`.jsonc`) defining all the parameters as Json for the union of Policies in the defined Initiative Definitions sorted an collated by Policy category and Policy display name. This Json file is useful when writing assignment files. You can use them with copy/paste and modify the parameter values in your assignment file(s). |
| 184 | + |
| 185 | +Each array entry defines three (3) files to be generated: Markdown, csv, and Json parameter file (.jsonc) |
| 186 | + |
| 187 | +- `pacEnvironment`: references the Policy as Code environment in `global-settings.jsonc` defining the tenant and root scope where the Policy and Initiative definitions are deployed. |
| 188 | +- `fileNameStem`: the file name without the extension (.md, .csv, .jsonc) |
| 189 | +- `title`: Heading 1 text for Markdown. |
| 190 | +- `initiatives`: list Initiatives (`id`) to be compared and included in the parameter Json file. The `shortName` is used for column headings. |
| 191 | + |
| 192 | +<br/> |
| 193 | + |
| 194 | +## Reading List |
| 195 | + |
| 196 | +1. **[Pipeline](../../Pipeline/README.md)** |
| 197 | + |
| 198 | +1. **[Update Global Settings](../../Definitions/README.md)** |
| 199 | + |
| 200 | +1. **[Create Policy Definitions](../../Definitions/Policies/README.md)** |
| 201 | + |
| 202 | +1. **[Create Initiative Definitions](../../Definitions/Initiatives/README.md)** |
| 203 | + |
| 204 | +1. **[Define Policy Assignments](../../Definitions/Assignments/README.md)** |
| 205 | + |
| 206 | +1. **[Documenting Assignments and Initiatives](../../Definitions/DocumentationSpecs/README.md)** |
| 207 | + |
| 208 | +1. **[Operational Scripts](../../Scripts/Operations/README.md)** |
| 209 | + |
| 210 | +**[Return to the main page](../../README.md)** |
| 211 | +<br/> |
0 commit comments