-
Notifications
You must be signed in to change notification settings - Fork 1
/
unionize.bicep
47 lines (39 loc) · 1.4 KB
/
unionize.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
@description('Name of Network Security Group to create.')
param parNetworkSecurityGroupName string
@description('The Azure Region to deploy the resources into.')
param parRegion string
@description('Tags you would like to be applied to the Network Security Group resource. Default: Empty Object')
param parTags object
@description('Definition of rules for the Network Security Group. Default: Empty Array')
param parNetworkSecurityGroupRules array = []
@description('Set default rule to allow or deny internet access. Default: false')
param parAllowInternetAccess bool = false
var varNoInternetRule = [
{
name: 'DenyInternet'
properties: {
protocol: '*'
sourcePortRange: '*'
destinationPortRange: '*'
sourceAddressPrefix: '*'
destinationAddressPrefix: 'Internet'
access: 'Deny'
priority: 100
direction: 'Outbound'
sourcePortRanges: []
destinationPortRanges: []
sourceAddressPrefixes: []
destinationAddressPrefixes: []
}
}
]
var varNsgRules = parAllowInternetAccess ? parNetworkSecurityGroupRules : union(parNetworkSecurityGroupRules, varNoInternetRule)
resource resNetworkSecurityGroup 'Microsoft.Network/networkSecurityGroups@2021-08-01' = {
name: parNetworkSecurityGroupName
location: parRegion
tags: parTags
properties: {
securityRules: varNsgRules
}
}
output outNetworkSecurityGroupId string = resNetworkSecurityGroup.id