Skip to content

Commit 018dd09

Browse files
committed
article complete
1 parent 3ca1570 commit 018dd09

File tree

2 files changed

+33
-37
lines changed

2 files changed

+33
-37
lines changed

articles/firewall/deploy-cli.md

Lines changed: 31 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: In this article, you learn how to deploy and configure Azure Firewa
44
services: firewall
55
author: vhorne
66
ms.service: firewall
7-
ms.date: 5/9/2019
7+
ms.date: 6/8/2019
88
ms.author: victorh
99
#Customer intent: As an administrator new to this service, I want to control outbound network access from resources located in an Azure subnet.
1010
---
@@ -20,7 +20,7 @@ One way you can control outbound network access from an Azure subnet is with Azu
2020

2121
Network traffic is subjected to the configured firewall rules when you route your network traffic to the firewall as the subnet default gateway.
2222

23-
For this article, you create a simplified single VNet with three subnets for easy deployment. For production deployments, a [hub and spoke model](https://docs.microsoft.com/azure/architecture/reference-architectures/hybrid-networking/hub-spoke) is recommended, where the firewall is in its own VNet. The workload servers are in peered VNets in the same region with one or more subnets.
23+
For this article, you create a simplified single VNet with three subnets for easy deployment. For production deployments, a [hub and spoke model](https://docs.microsoft.com/azure/architecture/reference-architectures/hybrid-networking/hub-spoke) is recommended. The firewall is in its own VNet. The workload servers are in peered VNets in the same region with one or more subnets.
2424

2525
* **AzureFirewallSubnet** - the firewall is in this subnet.
2626
* **Workload-SN** - the workload server is in this subnet. This subnet's network traffic goes through the firewall.
@@ -108,7 +108,21 @@ az vm create \
108108
az vm open-port --port 3389 --resource-group Test-FW-RG --name Srv-Jump
109109
```
110110

111-
Create a workload virtual machine with no public IP address.
111+
112+
113+
Create a NIC for Srv-Work with specific DNS server IP addresses and no public IP address to test with.
114+
115+
```azurecli-interactive
116+
az network nic create \
117+
-g Test-FW-RG \
118+
-n Srv-Work-NIC \
119+
--vnet-name Test-FW-VN \
120+
--subnet Workload-SN \
121+
--public-ip-address "" \
122+
--dns-servers 209.244.0.3 209.244.0.4
123+
```
124+
125+
Now create the workload virtual machine.
112126
When prompted, type a password for the virtual machine.
113127

114128
```azurecli-interactive
@@ -117,9 +131,7 @@ az vm create \
117131
--name Srv-Work \
118132
--location eastus \
119133
--image win2016datacenter \
120-
--vnet-name Test-FW-VN \
121-
--subnet Workload-SN \
122-
--public-ip-address "" \
134+
--nics Srv-Work-NIC \
123135
--admin-username azureadmin
124136
```
125137

@@ -146,11 +158,11 @@ az network firewall ip-config create \
146158
--vnet-name Test-FW-VN
147159
az network firewall update \
148160
--name Test-FW01 \
149-
--resource-group Test-FW-RG \
161+
--resource-group Test-FW-RG
150162
az network public-ip show \
151163
--name fw-pip \
152164
--resource-group Test-FW-RG
153-
fwpipaddr="$(az network public-ip list -g Test-FW-RG --query "[?name=='fw-pip'].ipAddress" --output tsv)"
165+
fwprivaddr="$(az network firewall ip-config list -g Test-FW-RG -f Test-FW01 --query "[?name=='FW-config'].privateIpAddress" --output tsv)"
154166
```
155167

156168
Note the private IP address. You'll use it later when you create the default route.
@@ -176,7 +188,7 @@ az network route-table route create \
176188
--route-table-name Firewall-rt-table \
177189
--address-prefix 0.0.0.0/0 \
178190
--next-hop-type VirtualAppliance \
179-
--next-hop-ip-address $fwpipaddr
191+
--next-hop-ip-address $fwprivaddr
180192
```
181193

182194
Associate the route table to the subnet
@@ -215,48 +227,29 @@ The network rule allows outbound access to two IP addresses at port 53 (DNS).
215227

216228
```azurecli-interactive
217229
az network firewall network-rule create \
218-
--collection-name RCNet01 \
230+
--collection-name Net-Coll01 \
219231
--destination-addresses 209.244.0.3 209.244.0.4 \
220232
--destination-ports 53 \
221233
--firewall-name Test-FW01 \
222234
--name Allow-DNS \
223235
--protocols UDP \
224236
--resource-group Test-FW-RG \
237+
--priority 200 \
225238
--source-addresses 10.0.2.0/24 \
226239
--action Allow
227240
```
228241

229-
```azurepowershell
230-
$NetRule1 = New-AzFirewallNetworkRule -Name "Allow-DNS" -Protocol UDP -SourceAddress 10.0.2.0/24 `
231-
-DestinationAddress 209.244.0.3,209.244.0.4 -DestinationPort 53
232-
233-
$NetRuleCollection = New-AzFirewallNetworkRuleCollection -Name RCNet01 -Priority 200 `
234-
-Rule $NetRule1 -ActionType "Allow"
235-
236-
$Azfw.NetworkRuleCollections = $NetRuleCollection
237-
238-
Set-AzFirewall -AzureFirewall $Azfw
239-
```
240-
241-
### Change the primary and secondary DNS address for the **Srv-Work** network interface
242-
243-
For testing purposes in this procedure, configure the server's primary and secondary DNS addresses. This isn't a general Azure Firewall requirement.
244-
245-
```azurepowershell
246-
$NIC.DnsSettings.DnsServers.Add("209.244.0.3")
247-
$NIC.DnsSettings.DnsServers.Add("209.244.0.4")
248-
$NIC | Set-AzNetworkInterface
249-
```
250-
251242
## Test the firewall
252243

253244
Now, test the firewall to confirm that it works as expected.
254245

255246
1. Note the private IP address for the **Srv-Work** virtual machine:
256247

257-
```
258-
$NIC.IpConfigurations.PrivateIpAddress
259-
```
248+
```azureclii-interactive
249+
az vm list-ip-addresses \
250+
-g Test-FW-RG \
251+
-n Srv-Work
252+
```
260253

261254
1. Connect a remote desktop to **Srv-Jump** virtual machine, and sign in. From there, open a remote desktop connection to the **Srv-Work** private IP address and sign in.
262255

@@ -290,8 +283,9 @@ So now you've verified that the firewall rules are working:
290283

291284
You can keep your firewall resources for the next tutorial, or if no longer needed, delete the **Test-FW-RG** resource group to delete all firewall-related resources:
292285

293-
```azurepowershell
294-
Remove-AzResourceGroup -Name Test-FW-RG
286+
```azurecli-interactive
287+
az group delete \
288+
-n Test-FW-RG
295289
```
296290

297291
## Next steps

articles/firewall/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939
items:
4040
- name: Deploy using Azure PowerShell
4141
href: deploy-ps.md
42+
- name: Deploy using Azure CLI
43+
href: deploy-cli.md
4244
- name: Deploy using a template
4345
href: deploy-template.md
4446
- name: Integrate with load balancer

0 commit comments

Comments
 (0)