Gallery › Network › Azure built-in policies
Audit flow logs configuration for every virtual network
Converted Policy Audit Disabled Mode Indexed Version 1.0.1
Audit for virtual network to verify if flow logs are configured. Enabling flow logs allows to log information about IP traffic flowing through virtual network. 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 JSONVirtualNetwork_FlowLog_Audit.json · 52 lines
{
"properties": {
"displayName": "Audit flow logs configuration for every virtual network",
"description": "Audit for virtual network to verify if flow logs are configured. Enabling flow logs allows to log information about IP traffic flowing through virtual network. It can be used for optimizing network flows, monitoring throughput, verifying compliance, detecting intrusions and more.",
"policyType": "BuiltIn",
"mode": "Indexed",
"metadata": {
"version": "1.0.1",
"category": "Network"
},
"version": "1.0.1",
"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/virtualNetworks"
},
{
"count": {
"field": "Microsoft.Network/virtualNetworks/flowLogs[*]"
},
"equals": 0
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"1.0.1",
"1.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/4c3c6c5f-0d47-4402-99b8-aa543dd8bcee",
"name": "4c3c6c5f-0d47-4402-99b8-aa543dd8bcee"
}Bylaw4c3c6c5f-0d47-4402-99b8-aa543dd8bcee.bylaw.ps1 · 29 lines
# Converted from VirtualNetwork_FlowLog_Audit.json by ConvertTo-Bylaw.
Policy '4c3c6c5f-0d47-4402-99b8-aa543dd8bcee' {
Properties @{
DisplayName = 'Audit flow logs configuration for every virtual network'
Description = 'Audit for virtual network to verify if flow logs are configured. Enabling flow logs allows to log information about IP traffic flowing through virtual network. It can be used for optimizing network flows, monitoring throughput, verifying compliance, detecting intrusions and more.'
Version = '1.0.1'
Category = 'Network'
PolicyVersion = '1.0.1'
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/virtualNetworks' {
Require 'flowLogs is as required' {
Count 'flowLogs[*]' | Must -Not -Be 0
}
}
Effect (Param Effect)
}Source: built-in-policies/policyDefinitions/Network/VirtualNetwork_FlowLog_Audit.json in Azure/azure-policy, under the MIT licence.
Bylaw