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

Policy: Implement DenyAction #1399

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
5f95a5b
initial policy definition creation
Aug 4, 2023
6f3863e
policy initiative
Aug 4, 2023
ddccad5
names and policy ids in initiative
Aug 4, 2023
5ae75aa
microsoft.insights/diagnosticsettings
Aug 4, 2023
2c2264b
update policies.bicep
Aug 4, 2023
cc3cdb2
update whats new
Aug 4, 2023
fbcb278
Merge branch 'main' into us29619
Aug 6, 2023
739814f
Merge branch 'main' into us29619
4pplied Aug 6, 2023
56183a9
Merge branch 'us29619' of https://github.com/JamJarchitect/Enterprise…
Aug 6, 2023
4669055
Merge branch 'policy-refresh-q1fy24' into us29619
Springstone Aug 8, 2023
10817d3
Auto-update Portal experience [Springstone/f9489013]
github-actions[bot] Aug 8, 2023
d3a98a0
Auto-update Portal experience [Springstone/f9489013]
github-actions[bot] Aug 8, 2023
ffb8280
troubleshooting down to types
Aug 15, 2023
5e2729e
Auto-update Portal experience [JamJarchitect/93e3b166]
github-actions[bot] Aug 15, 2023
b74afca
Merge branch 'main' into us29619
Aug 15, 2023
8439492
Auto-update Portal experience [JamJarchitect/93e3b166]
github-actions[bot] Aug 15, 2023
7eb8726
reset
Aug 15, 2023
072d6c7
Auto-update Portal experience [JamJarchitect/93e3b166]
github-actions[bot] Aug 15, 2023
14e980f
Merge branch 'policy-refresh-q1fy24' of https://github.com/Azure/Ente…
Aug 15, 2023
3cb66eb
Auto-update Portal experience [JamJarchitect/93e3b166]
github-actions[bot] Aug 15, 2023
f7ff4e4
denyaction activitylogs update
Aug 17, 2023
0cb3a3f
Auto-update Portal experience [JamJarchitect/f8b35de9]
github-actions[bot] Aug 17, 2023
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
9 changes: 9 additions & 0 deletions docs/wiki/Whats-new.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,15 @@ This article will be updated as and when changes are made to the above and anyth

Here's what's changed in Enterprise Scale/Azure Landing Zones:

### August 2023

#### Policy

- Added two new policy definitions:
- `DenyAction-ActivityLogs`
- `DenyAction-DiagnosticLogs`
- These two policy definitions prevent Activity Logs and Diagnostic Logs being deleted leveraging Azure Policy DenyAction functionality

### July 2023

Major update in this release: introducing the Policy Testing Framework foundation, along with tests for all assigned infrastructure policies that use the DENY effect. This will allow us to test the policies in a more automated fashion, and will help us to ensure that we don't introduce any regressions in the future. We will be adding tests for custom policies in the future.
Expand Down
156 changes: 81 additions & 75 deletions eslzArm/managementGroupTemplates/policyDefinitions/policies.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.19.5.34762",
"templateHash": "10448217912583139124"
"version": "0.20.4.51522",
"templateHash": "11768655431175792812"
}
},
"variables": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"name": "DenyAction-ActivityLogs",
"type": "Microsoft.Authorization/policyDefinitions",
"apiVersion": "2021-06-01",
"scope": null,
"properties": {
"policyType": "Custom",
"mode": "Indexed",
"displayName": "DenyAction implementation on Activity Logs",
"description": "This is a DenyAction implementation policy on Activity Logs.",
"metadata": {
"deprecated": false,
"version": "1.0.0",
"category": "Monitoring",
"source": "https://github.com/Azure/Enterprise-Scale/",
"alzCloudEnvironments": [
"AzureCloud",
"AzureChinaCloud",
"AzureUSGovernment"
]
},
"parameters": {},
"policyRule": {
"if": {
"field": "type",
"equals": "Microsoft.Resources/subscriptions/providers/diagnosticSettings"
},
"then": {
"effect": "denyAction",
"details": {
"actionNames": [
"delete"
]
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"name": "DenyAction-DiagnosticLogs",
"type": "Microsoft.Authorization/policyDefinitions",
"apiVersion": "2021-06-01",
"scope": null,
"properties": {
"policyType": "Custom",
"mode": "Indexed",
"displayName": "DenyAction implementation on Diagnostic Logs across resources",
"description": "DenyAction implementation on Diagnostic Logs across resources.",
"metadata": {
"deprecated": false,
"version": "1.0.0",
"category": "Monitoring",
"source": "https://github.com/Azure/Enterprise-Scale/",
"alzCloudEnvironments": [
"AzureCloud",
"AzureChinaCloud",
"AzureUSGovernment"
]
},
"parameters": {},
"policyRule": {
"if": {
"field": "type",
"equals": "Microsoft.Insights/diagnosticSettings"
},
"then": {
"effect": "denyAction",
"details": {
"actionNames": [
"delete"
]
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"name": "DenyAction-DeleteProtection",
"type": "Microsoft.Authorization/policySetDefinitions",
"apiVersion": "2021-06-01",
"scope": null,
"properties": {
"policyType": "Custom",
"displayName": "DenyAction Delete - Activity Logs and Diagnostic Settings",
"description": "Enforces DenyAction - Delete on Activity Logs and Diagnostic Settings.",
"metadata": {
"version": "1.0.0",
"category": "Monitoring",
"source": "https://github.com/Azure/Enterprise-Scale/",
"alzCloudEnvironments": [
"AzureCloud",
"AzureChinaCloud",
"AzureUSGovernment"
]
},
"parameters": {},
"policyDefinitions": [
{
"policyDefinitionReferenceId": "DenyActionDelete-DiagnosticLogs",
"policyDefinitionId": "/providers/Microsoft.Management/managementGroups/contoso/providers/Microsoft.Authorization/policyDefinitions/DenyAction-DiagnosticLogs",
"parameters": {},
"groupNames": []
},
{
"policyDefinitionReferenceId": "DenyActionDelete-ActivityLogs",
"policyDefinitionId": "/providers/Microsoft.Management/managementGroups/contoso/providers/Microsoft.Authorization/policyDefinitions/DenyAction-ActivityLogs",
"parameters": {},
"groupNames": []
}
],
"policyDefinitionGroups": null
}
}
3 changes: 3 additions & 0 deletions src/templates/policies.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ var loadPolicyDefinitions = {
loadTextContent('../resources/Microsoft.Authorization/policyDefinitions/Deploy-Windows-DomainJoin.json')
loadTextContent('../resources/Microsoft.Authorization/policyDefinitions/Deploy-Diagnostics-VWanS2SVPNGW.json')
loadTextContent('../resources/Microsoft.Authorization/policyDefinitions/Audit-PrivateLinkPrivateDnsZones.json')
loadTextContent('../resources/Microsoft.Authorization/policyDefinitions/DenyAction-DiagnosticLogs.json')
loadTextContent('../resources/Microsoft.Authorization/policyDefinitions/DenyAction-ActivityLogs.json')
]
AzureCloud: [
loadTextContent('../resources/Microsoft.Authorization/policyDefinitions/Audit-MachineLearning-PrivateEndpointId.json') // Needs validating in AzureChinaCloud and AzureUSGovernment
Expand Down Expand Up @@ -224,6 +226,7 @@ var loadPolicySetDefinitions = {
loadTextContent('../resources/Microsoft.Authorization/policySetDefinitions/Enforce-Guardrails-KeyVault.json')
loadTextContent('../resources/Microsoft.Authorization/policySetDefinitions/Enforce-ALZ-Decomm.json')
loadTextContent('../resources/Microsoft.Authorization/policySetDefinitions/Enforce-ALZ-Sandbox.json')
loadTextContent('../resources/Microsoft.Authorization/policySetDefinitions/DenyAction-DeleteProtection.json')
]
AzureCloud: [
loadTextContent('../resources/Microsoft.Authorization/policySetDefinitions/Deny-PublicPaaSEndpoints.json') // See AzureChinaCloud and AzureUSGovernment comments below for reasoning
Expand Down