Gallery › Network › Azure built-in policies
Network Watcher flow logs should have traffic analytics enabled
Converted Policy Audit Disabled Mode Indexed Version 1.0.1
Traffic analytics analyzes flow logs to provide insights into traffic flow in your Azure cloud. It can be used to visualize network activity across your Azure subscriptions and identify hot spots, identify security threats, understand traffic flow patterns, pinpoint network misconfigurations and more.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONNetworkWatcher_FlowLog_TrafficAnalytics_Audit.json · 60 lines
{
"properties": {
"displayName": "Network Watcher flow logs should have traffic analytics enabled",
"description": "Traffic analytics analyzes flow logs to provide insights into traffic flow in your Azure cloud. It can be used to visualize network activity across your Azure subscriptions and identify hot spots, identify security threats, understand traffic flow patterns, pinpoint network misconfigurations 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/networkWatchers/flowLogs"
},
{
"anyof": [
{
"field": "Microsoft.Network/networkWatchers/flowLogs/flowAnalyticsConfiguration.networkWatcherFlowAnalyticsConfiguration.enabled",
"equals": false
},
{
"field": "Microsoft.Network/networkWatchers/flowLogs/flowAnalyticsConfiguration.networkWatcherFlowAnalyticsConfiguration.trafficAnalyticsInterval",
"notin": [
"10",
"60"
]
}
]
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"1.0.1"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/2f080164-9f4d-497e-9db6-416dc9f7b48a",
"name": "2f080164-9f4d-497e-9db6-416dc9f7b48a"
}Bylaw2f080164-9f4d-497e-9db6-416dc9f7b48a.bylaw.ps1 · 33 lines
# Converted from NetworkWatcher_FlowLog_TrafficAnalytics_Audit.json by ConvertTo-Bylaw.
Policy '2f080164-9f4d-497e-9db6-416dc9f7b48a' {
Properties @{
DisplayName = 'Network Watcher flow logs should have traffic analytics enabled'
Description = 'Traffic analytics analyzes flow logs to provide insights into traffic flow in your Azure cloud. It can be used to visualize network activity across your Azure subscriptions and identify hot spots, identify security threats, understand traffic flow patterns, pinpoint network misconfigurations 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/networkWatchers/flowLogs' {
Require 'flowAnalyticsConfiguration.networkWatcherFlowAnalyticsConfiguration.enabled is not false' {
Field flowAnalyticsConfiguration.networkWatcherFlowAnalyticsConfiguration.enabled | Must -Not -Be $false -IfPresent
}
Require 'flowAnalyticsConfiguration.networkWatcherFlowAnalyticsConfiguration.trafficAnalyticsInterval is as required' {
Field flowAnalyticsConfiguration.networkWatcherFlowAnalyticsConfiguration.trafficAnalyticsInterval | Must -BeIn @('10', '60')
}
}
Effect (Param Effect)
}Source: built-in-policies/policyDefinitions/Network/NetworkWatcher_FlowLog_TrafficAnalytics_Audit.json in Azure/azure-policy, under the MIT licence.
Bylaw