> For the complete documentation index, see [llms.txt](https://cortex-docs.paloaltonetworks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cortex-docs.paloaltonetworks.com/posture-rules/cloud-saas-active-directory-posture-rules/cortex-posture-query-based-rules/detection-rules-by-name/azure-network-watcher-network-security-group-nsg-flow-logs-retention-is-less-than-90-days.md). Agents can also search and read this documentation through its [MCP server](https://cortex-docs.paloaltonetworks.com/~gitbook/mcp).

# Azure Network Watcher Network Security Group (NSG) flow logs retention is less than 90 days

### Synopsis

| Field               | Value                                                                                       |
| ------------------- | ------------------------------------------------------------------------------------------- |
| Rule Type           | Detection                                                                                   |
| Finding Type        | Azure Network Watcher Network Security Group (NSG) flow logs retention is less than 90 days |
| Finding ID          | 60000216                                                                                    |
| Generates a Finding | This detection rule also generates a finding                                                |
| Severity            | Informational                                                                               |
| Category            | CONFIGURATION                                                                               |
| Cloud Providers     | AZURE                                                                                       |
| Platform Module     | CSPM                                                                                        |
| Asset Types         | AZURE\_SECURITY\_GROUP                                                                      |

### Description

Azure Network Security Groups (NSGs) with flow log retention periods less than 90 days present a security risk. Insufficient log retention hinders incident response and security investigations, potentially delaying detection and remediation of security breaches.

NSG flow logs, managed via the Network Watcher service, record detailed network traffic information, including allowed and denied flows. Short retention periods limit the historical data available for analysis, hindering investigation of past attacks or misconfigurations. Attackers could exploit this by remaining undetected for longer periods, potentially exfiltrating sensitive data or establishing persistent access before logs are purged.

The impact of this misconfiguration is reduced visibility into network activity, increasing the mean time to detect (MTTD) and mean time to respond (MTTR) for security incidents. Maintaining at least 90 days of flow logs allows for thorough investigation of security events, identifying attack patterns and root causes, improving overall security posture.

To mitigate this risk, ensure all NSGs have flow logs enabled with a retention period of at least 90 days. Regularly review and adjust the retention policy as needed, balancing storage costs with the need for adequate historical data for security analysis. Enable alerts for NSGs nearing the end of their log retention period to prevent accidental data loss.

### Remediation

Follow the below steps to update retention days for flow logs via Azure Portal:

1. Log in to the Azure portal.
2. Search 'Network foundation'.
3. Under 'Virtual Network', Select 'Network security groups'
4. Search and Click the Network security group for which you need to modify the flow log settings.
5. Under 'Monitoring', Select 'NSG flow logs'.
6. Click the flow log, and under 'Storage Account', Set the 'Retention days' to 90 days or greater.
7. 'Save' your changes.

Use the below command to enable flow logs for Network security group via Azure CLI:

```
az network watcher flow-log update --name <Flow Log name> --nsg <NSG name> --resource-group <Resource Group name> --storage-account <Storage account> --enabled true --retention <Retention Days> --location <location>
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://cortex-docs.paloaltonetworks.com/posture-rules/cloud-saas-active-directory-posture-rules/cortex-posture-query-based-rules/detection-rules-by-name/azure-network-watcher-network-security-group-nsg-flow-logs-retention-is-less-than-90-days.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
