|
4 | 4 | "metadata": { |
5 | 5 | "_generator": { |
6 | 6 | "name": "bicep", |
7 | | - "version": "0.44.1.10279", |
8 | | - "templateHash": "8094453408631886471" |
| 7 | + "version": "0.46.1.21595", |
| 8 | + "templateHash": "2884941074303245104" |
9 | 9 | } |
10 | 10 | }, |
11 | 11 | "parameters": { |
|
78 | 78 | }, |
79 | 79 | "scriptUri": { |
80 | 80 | "type": "string", |
81 | | - "defaultValue": "[uri(deployment().properties.templateLink.uri, 'linuxrouter.sh')]", |
| 81 | + "defaultValue": "[uri(deployment().properties.templateLink.uri, '../../scripts/linux/linuxrouter.sh')]", |
82 | 82 | "metadata": { |
83 | 83 | "description": "Script that will be executed" |
84 | 84 | } |
|
103 | 103 | "metadata": { |
104 | 104 | "description": "Deploy Public IP Address" |
105 | 105 | } |
| 106 | + }, |
| 107 | + "allowSshFromAddressPrefix": { |
| 108 | + "type": "string", |
| 109 | + "defaultValue": "", |
| 110 | + "metadata": { |
| 111 | + "description": "Source address prefix allowed to reach the VM on TCP 22, for example 203.0.113.4/32. Standard SKU public IPs deny inbound traffic by default, so leave this empty only if you do not need SSH from the internet. Use Internet to allow any source (not recommended)." |
| 112 | + } |
106 | 113 | } |
107 | 114 | }, |
108 | 115 | "variables": { |
109 | 116 | "extensionName": "CustomScript", |
110 | 117 | "nicName": "[format('{0}-NIC', parameters('virtualMachineName'))]", |
111 | 118 | "publicIPAddressName": "[format('{0}-PublicIP', parameters('virtualMachineName'))]", |
| 119 | + "sshSecurityRules": "[if(empty(parameters('allowSshFromAddressPrefix')), createArray(), createArray(createObject('name', 'Allow-SSH-Inbound', 'properties', createObject('priority', 200, 'protocol', 'Tcp', 'access', 'Allow', 'direction', 'Inbound', 'sourceAddressPrefix', parameters('allowSshFromAddressPrefix'), 'sourcePortRange', '*', 'destinationAddressPrefix', '*', 'destinationPortRange', '22'))))]", |
112 | 120 | "osVersionDefinitions": { |
113 | 121 | "22.04": { |
114 | 122 | "publisher": "Canonical", |
|
131 | 139 | "name": "default-nsg", |
132 | 140 | "location": "[parameters('location')]", |
133 | 141 | "properties": { |
134 | | - "securityRules": [ |
135 | | - { |
136 | | - "name": "Allow-Traffic-RFC-1918", |
137 | | - "properties": { |
138 | | - "priority": 300, |
139 | | - "protocol": "*", |
140 | | - "access": "Allow", |
141 | | - "direction": "Inbound", |
142 | | - "sourceAddressPrefixes": [ |
143 | | - "10.0.0.0/8", |
144 | | - "172.16.0.0/12", |
145 | | - "192.168.0.0/16" |
146 | | - ], |
147 | | - "sourcePortRange": "*", |
148 | | - "destinationAddressPrefix": "*", |
149 | | - "destinationPortRange": "*" |
150 | | - } |
151 | | - } |
152 | | - ] |
| 142 | + "securityRules": "[concat(variables('sshSecurityRules'), createArray(createObject('name', 'Allow-Traffic-RFC-1918', 'properties', createObject('priority', 300, 'protocol', '*', 'access', 'Allow', 'direction', 'Inbound', 'sourceAddressPrefixes', createArray('10.0.0.0/8', '172.16.0.0/12', '192.168.0.0/16'), 'sourcePortRange', '*', 'destinationAddressPrefix', '*', 'destinationPortRange', '*'))))]" |
153 | 143 | } |
154 | 144 | }, |
155 | 145 | { |
|
0 commit comments