-
Notifications
You must be signed in to change notification settings - Fork 323
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Audit - StorageAccounts Should Have Lifecycle Policy Enabled
- Loading branch information
Showing
3 changed files
with
103 additions
and
0 deletions.
There are no files selected for viewing
58 changes: 58 additions & 0 deletions
58
...tions/Storage/audit-storageaccounts-should-have-lifecycle-policy-enabled/azurepolicy.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
{ | ||
"name": "bc1e3f2c-692d-4e3e-ab47-9273a71d8079", | ||
"type": "Microsoft.Authorization/policyDefinitions", | ||
"properties": { | ||
"displayName": "Audit - StorageAccounts Should Have Lifecycle Policy Enabled", | ||
"description": "This policy audits storage accounts that do not have at least one management policy of type lifecycle enabled.", | ||
"metadata": { | ||
"version": "1.0.0", | ||
"category": "Storage" | ||
}, | ||
"mode": "All", | ||
"parameters": { | ||
"effect": { | ||
"type": "String", | ||
"metadata": { | ||
"displayName": "Effect", | ||
"description": "AuditIfNotExists or Disabled the execution of the Policy" | ||
}, | ||
"allowedValues": [ | ||
"AuditIfNotExists", | ||
"Disabled" | ||
], | ||
"defaultValue": "AuditIfNotExists" | ||
} | ||
}, | ||
"policyRule": { | ||
"if": { | ||
"field": "type", | ||
"equals": "Microsoft.Storage/storageAccounts" | ||
}, | ||
"then": { | ||
"effect": "[parameters('effect')]", | ||
"details": { | ||
"type": "Microsoft.Storage/storageAccounts/managementPolicies", | ||
"name": "[concat(field('name'), '/default')]", | ||
"existenceCondition": { | ||
"count": { | ||
"field": "Microsoft.Storage/storageAccounts/managementPolicies/policy.rules[*]", | ||
"where": { | ||
"allOf": [ | ||
{ | ||
"field": "Microsoft.Storage/storageAccounts/managementPolicies/policy.rules[*].enabled", | ||
"equals": true | ||
}, | ||
{ | ||
"field": "Microsoft.Storage/storageAccounts/managementPolicies/policy.rules[*].type", | ||
"equals": "Lifecycle" | ||
} | ||
] | ||
} | ||
}, | ||
"greater": 0 | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...ge/audit-storageaccounts-should-have-lifecycle-policy-enabled/azurepolicy.parameters.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"effect": { | ||
"type": "String", | ||
"metadata": { | ||
"displayName": "Effect", | ||
"description": "AuditIfNotExists or Disabled the execution of the Policy" | ||
}, | ||
"allowedValues": [ | ||
"AuditIfNotExists", | ||
"Disabled" | ||
], | ||
"defaultValue": "AuditIfNotExists" | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
...Storage/audit-storageaccounts-should-have-lifecycle-policy-enabled/azurepolicy.rules.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"if": { | ||
"field": "type", | ||
"equals": "Microsoft.Storage/storageAccounts" | ||
}, | ||
"then": { | ||
"effect": "[parameters('effect')]", | ||
"details": { | ||
"type": "Microsoft.Storage/storageAccounts/managementPolicies", | ||
"name": "[concat(field('name'), '/default')]", | ||
"existenceCondition": { | ||
"count": { | ||
"field": "Microsoft.Storage/storageAccounts/managementPolicies/policy.rules[*]", | ||
"where": { | ||
"allOf": [ | ||
{ | ||
"field": "Microsoft.Storage/storageAccounts/managementPolicies/policy.rules[*].enabled", | ||
"equals": true | ||
}, | ||
{ | ||
"field": "Microsoft.Storage/storageAccounts/managementPolicies/policy.rules[*].type", | ||
"equals": "Lifecycle" | ||
} | ||
] | ||
} | ||
}, | ||
"greater": 0 | ||
} | ||
} | ||
} | ||
} |