Virtual Network should have diagnostic settings configured

Medium Azure General vnet-diagnostics

Applies to

  • Microsoft.Network/virtualNetworks

What CGPulse checks

A resource passes this rule when diagnosticSettings.hasSettings must equal true. Anything else is reported as a finding with the evaluated property value attached as evidence.

How to fix it

Configure diagnostic settings to capture security events and operational data. In Azure Portal: VNet > Diagnostic settings > Add diagnostic setting. See: https://learn.microsoft.com/en-us/azure/virtual-network/monitor-virtual-network

CLI

az monitor diagnostic-settings create --resource "{id}" --name "{name}-diag" --workspace var.workspace_id --logs "[{categoryGroup:allLogs,enabled:true}]" --metrics "[{category:AllMetrics,enabled:true}]"

Terraform

resource "azurerm_monitor_diagnostic_setting" "vnet" {
  name                       = "{name}-diag"
  target_resource_id         = "{id}"
  log_analytics_workspace_id = var.workspace_id
  enabled_log {
    category_group = "allLogs"
  }
}

Compliance frameworks

Vendor documentation

Is your environment compliant with this rule?

CGPulse checks it — and 621 others — against your Azure and AWS accounts with read-only access.

Run a free scan

Related Azure rules

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please reload the page.