Gallery › Network › Azure built-in policies
Flow logs should be configured for every network security group
Converted Policy Audit Disabled Mode Indexed Version 1.1.0
Audit for network security groups to verify if flow logs are configured. Enabling flow logs allows to log information about IP traffic flowing through network security group. It can be used for optimizing network flows, monitoring throughput, verifying compliance, detecting intrusions and more.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONNetworkSecurityGroup_FlowLog_Audit.json · 51 lines
{
"properties": {
"displayName": "Flow logs should be configured for every network security group",
"description": "Audit for network security groups to verify if flow logs are configured. Enabling flow logs allows to log information about IP traffic flowing through network security group. It can be used for optimizing network flows, monitoring throughput, verifying compliance, detecting intrusions and more.",
"policyType": "BuiltIn",
"mode": "Indexed",
"metadata": {
"version": "1.1.0",
"category": "Network"
},
"version": "1.1.0",
"parameters": {
"effect": {
"type": "string",
"defaultValue": "Audit",
"allowedValues": [
"Audit",
"Disabled"
],
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
}
}
},
"policyRule": {
"if": {
"allof": [
{
"field": "type",
"equals": "Microsoft.Network/networkSecurityGroups"
},
{
"count": {
"field": "Microsoft.Network/networkSecurityGroups/flowLogs[*]"
},
"equals": 0
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"1.1.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/c251913d-7d24-4958-af87-478ed3b9ba41",
"name": "c251913d-7d24-4958-af87-478ed3b9ba41"
}Bylawc251913d-7d24-4958-af87-478ed3b9ba41.bylaw.ps1 · 29 lines
# Converted from NetworkSecurityGroup_FlowLog_Audit.json by ConvertTo-Bylaw.
Policy 'c251913d-7d24-4958-af87-478ed3b9ba41' {
Properties @{
DisplayName = 'Flow logs should be configured for every network security group'
Description = 'Audit for network security groups to verify if flow logs are configured. Enabling flow logs allows to log information about IP traffic flowing through network security group. It can be used for optimizing network flows, monitoring throughput, verifying compliance, detecting intrusions and more.'
Version = '1.1.0'
Category = 'Network'
PolicyVersion = '1.1.0'
Mode = 'Indexed'
}
Parameter Effect @{
Type = 'string'
AllowedValues = @('Audit', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.Network/networkSecurityGroups' {
Require 'flowLogs is as required' {
Count 'flowLogs[*]' | Must -Not -Be 0
}
}
Effect (Param Effect)
}Source: built-in-policies/policyDefinitions/Network/NetworkSecurityGroup_FlowLog_Audit.json in Azure/azure-policy, under the MIT licence.
Bylaw