Project: KICS (Provisioning / Security & Compliance)
File: 25684eac-daaa-4c2c-94b4-8d2dbb627909.md

title: Unrecommended Log Profile Retention Policy hide: toc: true navigation: true <style> .highlight .hll { background-color: #ff171742; } .md-content { max-width: 1100px; margin: 0 auto; } </style> Query id: 25684eac-daaa-4c2c-94b4-8d2dbb627909 Query name: Unrecommended Log Profile Retention Policy Platform: AzureResourceManager Severity: <span style="color:#edd57e">Low</span> Category: Observability URL: Log Profile Retention Policy should be enabled and the recommended number of days for the retention should be higher than 365 or 0 (0 will retain the events indefinitely)<br> ```json title="Positive test num. 1 - json file" hl_lines="26" { "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "2.0.0.0", "apiProfile": "2019-03-01-hybrid", "parameters": {}, "variables": {}, "functions": [], "resources": [ { "name": "string", "type": "microsoft.insights/logprofiles", "apiVersion": "2016-03-01", "location": "location", "tags": {}, "properties": { "storageAccountId": "storageAccountId", "serviceBusRuleId": "serviceBusRuleId", "locations": [ "location1" ], "categories": [ "Write" ], "retentionPolicy": { "enabled": true, "days": 300 } } } ], "outputs": {} } ``` ```json title="Positive test num. 2 - json file" hl_lines="25 26" { "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "2.0.0.0", "apiProfile": "2019-03-01-hybrid", "parameters": {}, "variables": {}, "functions": [], "resources": [ { "name": "string", "type": "microsoft.insights/logprofiles", "apiVersion": "2016-03-01", "location": "location", "tags": {}, "properties": { "storageAccountId": "storageAccountId", "serviceBusRuleId": "serviceBusRuleId", "locations": [ "location1" ], "categories": [ "Write" ], "retentionPolicy": { "enabled": false, "days": 300 } } } ], "outputs": {} } ``` ```json title="Positive test num. 3 - json file" hl_lines="28" { "properties": { "template": { "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "2.0.0.0", "apiProfile": "2019-03-01-hybrid", "parameters": {}, "variables": {}, "functions": [], "resources": [ { "name": "string", "type": "microsoft.insights/logprofiles", "apiVersion": "2016-03-01", "location": "location", "tags": {}, "properties": { "storageAccountId": "storageAccountId", "serviceBusRuleId": "serviceBusRuleId", "locations": [ "location1" ], "categories": [ "Write" ], "retentionPolicy": { "enabled": true, "days": 300 } } } ], "outputs": {} }, "parameters": {} }, "kind": "template", "type": "Microsoft.Blueprint/blueprints/artifacts", "name": "myTemplate" } ``` <details><summary>Positive test num. 4 - json file</summary> ```json hl_lines="27 28" { "properties": { "template": { "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "2.0.0.0", "apiProfile": "2019-03-01-hybrid", "parameters": {}, "variables": {}, "functions": [], "resources": [ { "name": "string", "type": "microsoft.insights/logprofiles", "apiVersion": "2016-03-01", "location": "location", "tags": {}, "properties": { "storageAccountId": "storageAccountId", "serviceBusRuleId": "serviceBusRuleId", "locations": [ "location1" ], "categories": [ "Write" ], "retentionPolicy": { "enabled": false, "days": 300 } } } ], "outputs": {} }, "parameters": {} }, "kind": "template", "type": "Microsoft.Blueprint/blueprints/artifacts", "name": "myTemplate" } ``` </details> ```json title="Negative test num. 1 - json file" { "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "2.0.0.0", "apiProfile": "2019-03-01-hybrid", "parameters": {}, "variables": {}, "functions": [], "resources": [ { "name": "string", "type": "microsoft.insights/logprofiles", "apiVersion": "2016-03-01", "location": "location", "tags": {}, "properties": { "storageAccountId": "storageAccountId", "serviceBusRuleId": "serviceBusRuleId", "locations": [ "location1" ], "categories": [ "Write" ], "retentionPolicy": { "enabled": true, "days": 400 } } } ], "outputs": {} } ``` ```json title="Negative test num. 2 - json file" { "properties": { "template": { "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "2.0.0.0", "apiProfile": "2019-03-01-hybrid", "parameters": {}, "variables": {}, "functions": [], "resources": [ { "name": "string", "type": "microsoft.insights/logprofiles", "apiVersion": "2016-03-01", "location": "location", "tags": {}, "properties": { "storageAccountId": "storageAccountId", "serviceBusRuleId": "serviceBusRuleId", "locations": [ "location1" ], "categories": [ "Write" ], "retentionPolicy": { "enabled": true, "days": 400 } } } ], "outputs": {} }, "parameters": {} }, "kind": "template", "type": "Microsoft.Blueprint/blueprints/artifacts", "name": "myTemplate" } ```