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

Denyactionpr #1406

Merged
merged 20 commits into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from 5 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
4 changes: 4 additions & 0 deletions docs/wiki/Whats-new.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ Major update in this release: introducing the Policy Testing Framework foundatio
- Deploy-SQL-minTLS
- Deploy-MySQL-sslEnforcement (changed from Owner to Contributor role, no built in roles currently available)
- Deploy-PostgreSQL-sslEnforcement (changed from Owner to Contributor role, no built in roles currently available)
- Additional policy definitions:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Additional policy definitions:
- Adding `DenyAction` policy definitions:

- `DenyAction-ActivityLogs`
- `DenyAction-DiagnosticLogs`
- These two policy definitions prevent Activity Log Settings and Diagnostic Settings being deleted leveraging Azure Policy DenyAction functionality
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- These two policy definitions prevent Activity Log Settings and Diagnostic Settings being deleted leveraging Azure Policy DenyAction functionality
- These two policy definitions prevent Activity Log Settings and Diagnostic Settings being deleted leveraging Azure Policy DenyAction functionality
- Additionally including an initiative that includes both `DenyAction` policies


### July 2023

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
@@ -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.",
"description": "DenyAction implementation on Diagnostic 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.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 Log Settings and Diagnostic Settings",
"description": "Enforces DenyAction - Delete on Activity Log Settings 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-DiagnosticSettings",
"policyDefinitionId": "/providers/Microsoft.Management/managementGroups/contoso/providers/Microsoft.Authorization/policyDefinitions/DenyAction-DiagnosticSettings",
"parameters": {},
"groupNames": []
},
{
"policyDefinitionReferenceId": "DenyActionDelete-ActivityLogSettings",
"policyDefinitionId": "/providers/Microsoft.Management/managementGroups/contoso/providers/Microsoft.Authorization/policyDefinitions/DenyAction-ActivityLogSettings",
"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-DiagnosticSettings.json')
loadTextContent('../resources/Microsoft.Authorization/policyDefinitions/DenyAction-ActivityLogSettings.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