-
Notifications
You must be signed in to change notification settings - Fork 0
/
flowlog.bicep
51 lines (49 loc) · 1.28 KB
/
flowlog.bicep
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
Create a flow log for a virtual network
https://docs.microsoft.com/en-us/azure/templates/microsoft.network/networkwatchers/flowlogs
*/
param copies int
param flowlogSt_name string
param networkwatcher_name string
param location string
param sourceIPaddressRDP string
param rgName string
param virtualNetworkName string
param subnetName string
resource networkwatcher 'Microsoft.Network/networkWatchers@2020-11-01' = {
name: networkwatcher_name
location: location
tags: {
environment: 'Production'
}
}
resource vnetflow 'Microsoft.Network/networkWatchers/flowLogs@2023-05-01' = [for i in range(0, copies):{
name: 'vnetflow${i}'
location: location
parent: networkwatcher
properties: {
targetResourceId: resourceId(rgName, 'Microsoft.Network/virtualNetworks', '${virtualNetworkName}${i}')
storageId: resourceId(rgName, 'Microsoft.Storage/storageAccounts', flowlogSt_name)
enabled: true
retentionPolicy: {
enabled: true
days: 7
}
format: {
type: 'JSON'
}
flowAnalyticsConfiguration: {
publicNetwork: {
enabled: true
intervalInSeconds: 60
samplingRatePercentage: 100
}
privateNetwork: {
enabled: true
intervalInSeconds: 60
samplingRatePercentage: 100
}
}
}
}
]