Skip to content

Commit 5b288a0

Browse files
authored
Merge pull request #982 from Azure/feature/apy/6_18_25_docUpdates
Updated documentation
2 parents f2da820 + ad95068 commit 5b288a0

File tree

7 files changed

+214
-126
lines changed

7 files changed

+214
-126
lines changed

Docs/integrating-with-alz-library.md

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ Carefully review the generated policy assigments and ensure all parameter and sc
8989

9090
2. When complete run `Build-DeploymentPlans` to ensure the correct changes are made. During the first sync for either a new or existing environment there will be many changes due to updating of the existing policies.
9191

92-
## Example
92+
## Examples
9393

9494
### ALZ
9595

@@ -105,11 +105,14 @@ Sync-ALZPolicyFromLibrary -DefinitionsRootFolder .\Definitions -Type ALZ -PacEnv
105105

106106
For users interested in deploying the [Azure Monitor Baseline Alerts](https://azure.github.io/azure-monitor-baseline-alerts/welcome/) project with EPAC - these policies have been extracted and converted to the EPAC format and are available at the [amba-export](https://github.com/anwather/amba-export) repository.
107107

108+
> [!Note]
109+
> Review breaking changes on the [AMBA Releases](https://azure.github.io/azure-monitor-baseline-alerts/patterns/alz/HowTo/UpdateToNewReleases/) page to ensure policy deployments. In most cases, it's an update of a parameter type (i.e. String -> Array).
110+
108111
```ps1
109-
# Create a Pac Environment default file for ALZ policies using the latest version of the ALZ Library
112+
# Create a Pac Environment default file for AMBA policies using the latest version of the ALZ Library
110113
New-ALZPolicyDefaultStructure -DefinitionsRootFolder .\Definitions -Type AMBA -PacEnvironmentSelector "epac-dev"
111114
112-
# Sync the ALZ policies and assign to the "epac-dev" PAC environment.
115+
# Sync the AMBA policies and assign to the "epac-dev" PAC environment.
113116
Sync-ALZPolicyFromLibrary -DefinitionsRootFolder .\Definitions -Type AMBA -PacEnvironmentSelector "epac-dev"
114117
```
115118

@@ -118,11 +121,11 @@ Sync-ALZPolicyFromLibrary -DefinitionsRootFolder .\Definitions -Type AMBA -PacEn
118121
For users interested in deploying the [Sovereignty Policy Baseline](https://github.com/Azure/sovereign-landing-zone/blob/main/docs/scenarios/Sovereignty-Baseline-Policy-Initiatives.md) project with EPAC - these policies have been extracted and converted to the EPAC format and are available at the [spb-export](https://github.com/anwather/spb-export) repository.
119122

120123
```ps1
121-
# Create a Pac Environment default file for ALZ policies using the latest version of the ALZ Library
122-
New-ALZPolicyDefaultStructure -DefinitionsRootFolder .\Definitions -Type AMBA -PacEnvironmentSelector "epac-dev"
124+
# Create a Pac Environment default file for SLZ policies using the latest version of the ALZ Library
125+
New-ALZPolicyDefaultStructure -DefinitionsRootFolder .\Definitions -Type SLZ -PacEnvironmentSelector "epac-dev"
123126
124-
# Sync the ALZ policies and assign to the "epac-dev" PAC environment.
125-
Sync-ALZPolicyFromLibrary -DefinitionsRootFolder .\Definitions -Type AMBA -PacEnvironmentSelector "epac-dev"
127+
# Sync the SLZ policies and assign to the "epac-dev" PAC environment.
128+
Sync-ALZPolicyFromLibrary -DefinitionsRootFolder .\Definitions -Type SLZ -PacEnvironmentSelector "epac-dev"
126129
```
127130

128131
## Advanced Scenarios
@@ -132,7 +135,7 @@ Using the format of the Azure Landing Zones repository it is possible to extend
132135
- Modifying the management group structure (add new groups and archetypes)
133136
- Add/Remove policies from an archetype
134137

135-
### Maintaining multiple ALZ/AMBA environment with different parameter / management group values
138+
### Maintaining multiple ALZ/AMBA environments
136139

137140
If you need to have separate parameter values or different management group names for different PAC environments you can follow steps below.
138141

@@ -148,3 +151,21 @@ alz.policy_default_structure.<PAC SELECTOR>.jsonc
148151

149152
2. When syncing policies run the `Sync-ALZPolicyFromLibrary` once for each PAC Environment. A folder specific for that Pac Selector will now be placed within the ALZ Type.
150153

154+
### Disabling / Changes specific parameters
155+
156+
If you need to disable a single policy parameter, such as the 'effect' for a specific Defender for Cloud, add that specific parameter to your default file structure to ensure it does not get overwritten when running the **Sync-ALZPolicyFromLibrary** command.
157+
158+
An example of disabling the **"Configure Microsoft Defender for Key Vault plan"** in the **"Deploy-MDFC-Config-H224"** Policy Assignment.
159+
160+
```json
161+
"enableAscForKeyVault_effect": {
162+
"policy_assignment_name": [
163+
"Deploy-MDFC-Config-H224"
164+
],
165+
"description": "Enable or disable the execution of the Key Vault DFC policy.",
166+
"parameters": {
167+
"parameter_name": "enableAscForKeyVault",
168+
"value": "Disabled" // Update the value here as required by the description
169+
}
170+
}
171+
```

Docs/policy-assignments-csv-parameters.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ In the example header below the infrastructure environments prod, test, dev, and
2525
The CSV file generated contains the following headers/columns:
2626

2727
* `name` is the name of the policyDefinition referenced by the Policy Sets being assigned.
28-
* `referencePath` is only used if the Policy is used more than once in at least one of the Policy Sets to disambiguate them. The format is `<policySetName>\\<policyDefinitionReferenceId>`.
28+
* `referencePath` is only used if the Policy is used more than once in at least one of the Policy Sets to disambiguate them. The format is `<policySetName>//<policyDefinitionReferenceId>`.
2929
* `policyType`,`category`,`displayName`,`description`,`groupNames`,`policySets`,`allowedEffects` are optional and not used for deployment planning. They assist you in filling out the `<env>Effect` columns. The CSV file is sorted alphabetically by `category` and `displayName`.
3030
* `<env>Effect` columns must contain one of the allowedValues or allowedOverrides values. You define which scopes define each type of environment and what short name you give the environment type to use as a column prefix.
3131
* `<env>Parameters` can contain additional parameters. You can also specify such parameters in JSON. EPAC will use the union of all parameters.

Docs/policy-assignments.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,70 @@
33

44
This chapter describes how **Policy Assignments** are handled by EPAC. Policy Assignments are the actual assignments of Policies and Policy Sets to scopes in Azure.
55

6+
## Templates
7+
8+
### Single Scope
9+
10+
Recommended for simple deployments to a single scope.
11+
12+
```json
13+
{
14+
"$schema": "https://raw.githubusercontent.com/Azure/enterprise-azure-policy-as-code/main/Schemas/policy-assignment-schema.json",
15+
"nodeName": "/Security/",
16+
"definitionEntry": {
17+
"displayName": "",
18+
"policySetName": ""
19+
},
20+
"assignment": {
21+
"name": "", //24 Character limit
22+
"displayName": "",
23+
"description": ""
24+
},
25+
"metadata": {},
26+
"enforcementMode": "Default",
27+
"parameters": {
28+
"effect": "Audit"
29+
},
30+
"scope": {
31+
"epac-dev": [
32+
"/providers/Microsoft.Management/managementGroups/epac-dev"
33+
]
34+
}
35+
}
36+
```
37+
### Multiple Scopes
38+
39+
Recommended for deployments to a multiple scope. Typically used for setting unique parameters per scope.
40+
41+
```json
42+
{
43+
"$schema": "https://raw.githubusercontent.com/Azure/enterprise-azure-policy-as-code/main/Schemas/policy-assignment-schema.json",
44+
"nodeName": "/Security/",
45+
"definitionEntry": {
46+
"policySetName": ""
47+
},
48+
"children": [
49+
{
50+
"nodeName": "epac-dev/",
51+
"assignment": {
52+
"name": "", //24 Character limit
53+
"displayName": "",
54+
"description": ""
55+
},
56+
"enforcementMode": "Default",
57+
"parameters": {
58+
"effect": "Audit"
59+
},
60+
"scope": {
61+
"epac-dev": [
62+
"/providers/Microsoft.Management/managementGroups/epac-dev"
63+
]
64+
}
65+
}
66+
]
67+
}
68+
```
69+
670
## Assignment JSON structure
771

872
Assignment JSON is hierarchical for efficient definitions, avoiding duplication (copy/paste) of JSON. Each branch of the tree is cumulative. Each tree node must include a `nodeName` - an arbitrary string exclusively used by EPAC to display an error location. EPAC concatenates a leading `/` and the nodeName entries encountered in the tree to create a "breadcrumbs" trail; therefore, we recommend that you use `/` to help separate the concatenated `nodeName`. The following partial and invalid assignment tree would create this error message.

Docs/policy-definitions.md

Lines changed: 41 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -6,49 +6,11 @@ Policy definition files are managed within the folder `policyDefinitions` under
66

77
The names of the definition JSON files don't matter, the Policy and Policy Set definitions are registered based on the `name` attribute. The solution also allows the use of JSON with comments by using `.jsonc` instead of `.json` for the file extension.
88

9-
### Custom Definitions
10-
11-
Custom definitions are uploaded to Azure at the time of initial deployment to a pacSelector. For each pacSelector, the definition is uploaded to the pacSelector's defined root. This makes it available to the entirity of that pacSelector, while facilitating code promotion by allowing each pacSelector to recieve the updated definition as part of the release/deployment process.
12-
13-
### Definition Delivery
14-
15-
[policy(Set)Definitions](https://learn.microsoft.com/en-us/azure/governance/policy/concepts/scope#definition-location) are deployed at the pacSelector root. This enables versioning on custom definitions to be put through the CI/CD based change process.
16-
17-
## JSON Schema
18-
19-
The GitHub repo contains a JSON schema which can be used in tools such as [VS Code](https://code.visualstudio.com/Docs/languages/json#_json-schemas-and-settings) to provide code completion.
20-
21-
To utilize the schema add a ```$schema``` tag to the JSON file.
22-
23-
```json
24-
{
25-
"$schema": "https://raw.githubusercontent.com/Azure/enterprise-azure-policy-as-code/main/Schemas/policy-definition-schema.json"
26-
}
27-
```
28-
29-
This schema is new in v7.4.x and may not be complete. Please let us know if we missed anything.
30-
31-
## Recommendations
32-
33-
* `"name"` is required and should be unique. It can be a GUID or a unique short name.
34-
* `"category"` should be one of the standard ones defined in built-in Policies.
35-
* Do not specify an `id`. The solution will ignore it.
36-
* Make the `effect` parameterized. Always use the parameter name `effect`.
37-
* Whenever feasible, provide a `defaultValue` for parameters, especially for the `effect` parameter.
38-
* Policy aliases are used by Azure Policy to refer to resource type properties in the `if` condition and in `existenceCondition`: <https://docs.microsoft.com/en-us/azure/governance/policy/concepts/definition-structure#aliases>.
39-
40-
## Metadata
41-
42-
It is customary to include a `category` and a `version` in the `metadata` section. The `category` should be one of the standard ones defined in built-in Policies. The `version` should be a semantic version number.
43-
44-
EPAC injects `deployedBy` into the `metadata` section. This is a string that identifies the deployment source. It defaults to `epac/$pacOwnerId/$pacSelector`. You can override this value in `global-settings.jsonc`
45-
46-
**Not recommended:** Adding `deployedBy` to the `metadata` section in the Policy definition file will override the value for this definition only from `global-settings.jsonc` or default value.
47-
48-
## Example
9+
## Template
4910

5011
```json
5112
{
13+
"$schema": "https://raw.githubusercontent.com/Azure/enterprise-azure-policy-as-code/main/Schemas/policy-definition-schema.json",
5214
"name": "Newly created GUID",
5315
"properties": {
5416
"displayName": "Policy Display Name",
@@ -72,13 +34,6 @@ EPAC injects `deployedBy` into the `metadata` section. This is a string that ide
7234
"Disabled"
7335
],
7436
"defaultValue": "Audit"
75-
},
76-
"YourParameter": {
77-
"type": "String",
78-
"metadata": {
79-
"displayName": "YourParameter",
80-
"description": "Your Parameter Description"
81-
}
8237
}
8338
},
8439
"policyRule": {
@@ -92,3 +47,42 @@ EPAC injects `deployedBy` into the `metadata` section. This is a string that ide
9247
}
9348
}
9449
```
50+
51+
### Custom Definitions
52+
53+
Custom definitions are uploaded to Azure at the time of initial deployment to a pacSelector. For each pacSelector, the definition is uploaded to the pacSelector's defined root. This makes it available to the entirity of that pacSelector, while facilitating code promotion by allowing each pacSelector to recieve the updated definition as part of the release/deployment process.
54+
55+
### Definition Delivery
56+
57+
[policy(Set)Definitions](https://learn.microsoft.com/en-us/azure/governance/policy/concepts/scope#definition-location) are deployed at the pacSelector root. This enables versioning on custom definitions to be put through the CI/CD based change process.
58+
59+
## JSON Schema
60+
61+
The GitHub repo contains a JSON schema which can be used in tools such as [VS Code](https://code.visualstudio.com/Docs/languages/json#_json-schemas-and-settings) to provide code completion.
62+
63+
To utilize the schema add a ```$schema``` tag to the JSON file.
64+
65+
```json
66+
{
67+
"$schema": "https://raw.githubusercontent.com/Azure/enterprise-azure-policy-as-code/main/Schemas/policy-definition-schema.json"
68+
}
69+
```
70+
71+
This schema is new in v7.4.x and may not be complete. Please let us know if we missed anything.
72+
73+
## Recommendations
74+
75+
* `"name"` is required and should be unique. It can be a GUID or a unique short name.
76+
* `"category"` should be one of the standard ones defined in built-in Policies.
77+
* Do not specify an `id`. The solution will ignore it.
78+
* Make the `effect` parameterized. Always use the parameter name `effect`.
79+
* Whenever feasible, provide a `defaultValue` for parameters, especially for the `effect` parameter.
80+
* Policy aliases are used by Azure Policy to refer to resource type properties in the `if` condition and in `existenceCondition`: <https://docs.microsoft.com/en-us/azure/governance/policy/concepts/definition-structure#aliases>.
81+
82+
## Metadata
83+
84+
It is customary to include a `category` and a `version` in the `metadata` section. The `category` should be one of the standard ones defined in built-in Policies. The `version` should be a semantic version number.
85+
86+
EPAC injects `deployedBy` into the `metadata` section. This is a string that identifies the deployment source. It defaults to `epac/$pacOwnerId/$pacSelector`. You can override this value in `global-settings.jsonc`
87+
88+
**Not recommended:** Adding `deployedBy` to the `metadata` section in the Policy definition file will override the value for this definition only from `global-settings.jsonc` or default value.

Docs/policy-exemptions.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,35 @@
33
> [!TIP]
44
> The changes implementing [Option **A** below](#option-a-policy-definition-ids-or-names) makes JSON files easier to read than CSV files. We recommend using **Policy definition Ids or Names** for new exemptions and **JSON** files instead of CSV files. Of course, CSV files are still supported. You may even mix and match the two formats in the same folder.
55
6+
## Templates
7+
8+
### JSON
9+
10+
```json
11+
{
12+
"exemptions": [
13+
{
14+
"name": "short-name",
15+
"displayName": "Descriptive name displayed on portal",
16+
"description": "More details",
17+
"exemptionCategory": "Waiver",
18+
"expiresOn": "",
19+
"scopes": [
20+
"/subscriptions/11111111-2222-3333-4444-555555555555",
21+
],
22+
"policyAssignmentId": "",
23+
}
24+
]
25+
}
26+
```
27+
28+
### CSV
29+
30+
```json
31+
name,displayName,description,exemptionCategory,expiresOn,scope,policyAssignmentId,policyDefinitionReferenceIds,metadata,assignmentScopeValidation
32+
Exemption_00000000000001,My display Name,Mitigated,,,,,,
33+
```
34+
635
## Exemption Folder Structure
736

837
Exemptions can be defined as JSON or CSV files (we recommend that you use JSON files). The names of the definition files don't matter. If multiple files exists in a folder, the lists from all the files are added together.

0 commit comments

Comments
 (0)