Project: KICS (Provisioning / Security & Compliance)
File: 564b70f8-41cd-4690-aff8-bb53add86bc9.md

title: Unrecommended Network Watcher Flow Log Retention Policy hide: toc: true navigation: true <style> .highlight .hll { background-color: #ff171742; } .md-content { max-width: 1100px; margin: 0 auto; } </style> Query id: 564b70f8-41cd-4690-aff8-bb53add86bc9 Query name: Unrecommended Network Watcher Flow Log Retention Policy Platform: AzureResourceManager Severity: <span style="color:#edd57e">Low</span> Category: Observability URL: Network Watcher Flow Log Retention Policy should be enabled and the recommended number of days for the retention should be higher than 90<br> ```json title="Positive test num. 1 - json file" hl_lines="20 21" { "$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": "flowlogs/sample", "type": "Microsoft.Network/networkWatchers/flowLogs", "apiVersion": "2020-11-01", "location": "location", "tags": {}, "properties": { "targetResourceId": "targetResourceId", "storageId": "storageId", "enabled": true, "retentionPolicy": { "days": 2, "enabled": false }, "format": { "type": "JSON" } } } ], "outputs": {} } ``` ```json title="Positive test num. 2 - json file" hl_lines="19 20" { "$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": "flowlogs/sample", "type": "Microsoft.Network/networkWatchers/FlowLogs", "apiVersion": "2020-11-01", "location": "location", "tags": {}, "properties": { "targetResourceId": "targetResourceId", "storageId": "storageId", "enabled": true, "retentionPolicy": { "days": 2 }, "format": { "type": "JSON" } } } ], "outputs": {} } ``` ```json title="Positive test num. 3 - json file" hl_lines="15" { "$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": "flowlogs/sample", "type": "Microsoft.Network/networkWatchers/FlowLogs", "apiVersion": "2020-11-01", "location": "location", "tags": {}, "properties": { "targetResourceId": "targetResourceId", "storageId": "storageId", "enabled": true, "format": { "type": "JSON" } } } ], "outputs": {} } ``` <details><summary>Positive test num. 4 - json file</summary> ```json hl_lines="15" { "$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": "flowlogs/sample", "type": "Microsoft.Network/networkWatchers/FlowLogs", "apiVersion": "2020-11-01", "location": "location", "tags": {}, "properties": { "targetResourceId": "targetResourceId", "storageId": "storageId", "retentionPolicy": { "days": 95, "enabled": true }, "format": { "type": "JSON" } } } ], "outputs": {} } ``` </details> <details><summary>Positive test num. 5 - json file</summary> ```json hl_lines="22 23" { "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": "flowlogs/sample", "type": "Microsoft.Network/networkWatchers/flowLogs", "apiVersion": "2020-11-01", "location": "location", "tags": {}, "properties": { "targetResourceId": "targetResourceId", "storageId": "storageId", "enabled": true, "retentionPolicy": { "days": 2, "enabled": false }, "format": { "type": "JSON" } } } ], "outputs": {} }, "parameters": {} }, "kind": "template", "type": "Microsoft.Blueprint/blueprints/artifacts", "name": "myTemplate" } ``` </details> <details><summary>Positive test num. 6 - json file</summary> ```json hl_lines="21 22" { "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": "flowlogs/sample", "type":

"apiVersion": "2020-11-01", "location": "location", "tags": {}, "properties": { "targetResourceId": "targetResourceId", "storageId": "storageId", "enabled": true, "retentionPolicy": { "days": 2 }, "format": { "type": "JSON" } } } ], "outputs": {} }, "parameters": {} }, "kind": "template", "type": "Microsoft.Blueprint/blueprints/artifacts", "name": "myTemplate" } ``` </details> <details><summary>Positive test num. 7 - json file</summary> ```json hl_lines="17" { "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": "flowlogs/sample", "type": "Microsoft.Network/networkWatchers/FlowLogs", "apiVersion": "2020-11-01", "location": "location", "tags": {}, "properties": { "targetResourceId": "targetResourceId", "storageId": "storageId", "enabled": true, "format": { "type": "JSON" } } } ], "outputs": {} }, "parameters": {} }, "kind": "template", "type": "Microsoft.Blueprint/blueprints/artifacts", "name": "myTemplate" } ``` </details> <details><summary>Positive test num. 8 - json file</summary> ```json hl_lines="17" { "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": "flowlogs/sample", "type": "Microsoft.Network/networkWatchers/FlowLogs", "apiVersion": "2020-11-01", "location": "location", "tags": {}, "properties": { "targetResourceId": "targetResourceId", "storageId": "storageId", "retentionPolicy": { "days": 95, "enabled": true }, "format": { "type": "JSON" } } } ], "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": "flowlogs/sample", "type": "Microsoft.Network/networkWatchers/flowLogs", "apiVersion": "2020-11-01", "location": "location", "tags": {}, "properties": { "targetResourceId": "targetResourceId", "storageId": "storageId", "enabled": true, "retentionPolicy": { "days": 92, "enabled": true }, "format": { "type": "JSON" } } } ], "outputs": {} } ``` ```json title="Negative test num. 2 - 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": "flowlogs/sample", "type": "Microsoft.Network/networkWatchers/FlowLogs", "apiVersion": "2020-11-01", "location": "location", "tags": {}, "properties": { "targetResourceId": "targetResourceId", "storageId": "storageId", "enabled": true, "retentionPolicy": { "days": 95, "enabled": true }, "format": { "type": "JSON" } } } ], "outputs": {} } ``` ```json title="Negative test num. 3 - 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": "flowlogs/sample", "type": "Microsoft.Network/networkWatchers/flowLogs", "apiVersion": "2020-11-01", "location": "location", "tags": {}, "properties": { "targetResourceId": "targetResourceId", "storageId": "storageId", "enabled": true, "retentionPolicy": { "days": 92, "enabled": true }, "format": { "type": "JSON" } } } ], "outputs": {} }, "parameters": {} }, "kind": "template", "type": "Microsoft.Blueprint/blueprints/artifacts", "name": "myTemplate" } ``` <details><summary>Negative test num. 4 - json file</summary> ```json { "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": "flowlogs/sample", "type": "Microsoft.Network/networkWatchers/FlowLogs", "apiVersion": "2020-11-01", "location": "location", "tags": {}, "properties": { "targetResourceId": "targetResourceId", "storageId": "storageId", "enabled": true, "retentionPolicy": { "days": 95, "enabled": true }, "format": { "type": "JSON" } } } ], "outputs": {} }, "parameters": {} }, "kind": "template", "type": "Microsoft.Blueprint/blueprints/artifacts", "name": "myTemplate" } ``` </details>