Skip to content

Commit 17a56a5

Browse files
committed
added more CLI code to tabs
1 parent 2c3b200 commit 17a56a5

File tree

1 file changed

+100
-2
lines changed

1 file changed

+100
-2
lines changed

articles/nat-gateway/tutorial-hub-spoke-route-nat.md

Lines changed: 100 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -901,7 +901,6 @@ A Windows Server 2022 virtual machine is used to test the outbound internet traf
901901
902902
# [**CLI**](#tab/cli)
903903
904-
905904
Use [az network nsg create](/cli/azure/network/nsg?view=azure-cli-latest#az_network_nsg_create) to create the network security group.
906905
907906
```azurecli-interactive
@@ -1224,6 +1223,37 @@ Create a route table to force all outbound internet and inter-spoke traffic thro
12241223
12251224
# [**CLI**](#tab/cli)
12261225
1226+
Use [az network route-table create](/cli/azure/network/route-table?view=azure-cli-latest#az_network_route_table_create) to create the route table.
1227+
1228+
```azurecli-interactive
1229+
az network route-table create \
1230+
--resource-group test-rg \
1231+
--name route-table-nat-spoke-2 \
1232+
--location westus2
1233+
```
1234+
1235+
Use [az network route-table route create](/cli/azure/network/route-table/route?view=azure-cli-latest#az_network_route_table_route_create) to create the route in the route table.
1236+
1237+
```azurecli-interactive
1238+
az network route-table route create \
1239+
--resource-group test-rg \
1240+
--route-table-name route-table-nat-spoke-2 \
1241+
--name default-via-nat-spoke-2 \
1242+
--address-prefix 0.0.0.0/0 \
1243+
--next-hop-type VirtualAppliance \
1244+
--next-hop-ip-address 10.0.0.10
1245+
```
1246+
1247+
Use [az network vnet subnet update](/cli/azure/network/vnet/subnet?view=azure-cli-latest#az_network_vnet_subnet_update) to associate the route table with the subnet.
1248+
1249+
```azurecli-interactive
1250+
az network vnet subnet update \
1251+
--resource-group test-rg \
1252+
--vnet-name vnet-spoke-2 \
1253+
--name subnet-private \
1254+
--route-table route-table-nat-spoke-2
1255+
```
1256+
12271257
---
12281258
12291259
## Create spoke two test virtual machine
@@ -1281,6 +1311,53 @@ Create a Windows Server 2022 virtual machine for the test virtual machine in spo
12811311
12821312
# [**CLI**](#tab/cli)
12831313
1314+
1315+
Use [az network nsg create](/cli/azure/network/nsg?view=azure-cli-latest#az_network_nsg_create) to create the network security group.
1316+
1317+
```azurecli-interactive
1318+
az network nsg create \
1319+
--resource-group test-rg \
1320+
--name nsg-spoke-2 \
1321+
--location eastus2
1322+
```
1323+
1324+
Use [az network nsg rule create](/cli/azure/network/nsg/rule?view=azure-cli-latest#az_network_nsg_rule_create) to create an inbound NSG rule for HTTP.
1325+
1326+
```azurecli-interactive
1327+
az network nsg rule create \
1328+
--resource-group test-rg \
1329+
--nsg-name nsg-spoke-2 \
1330+
--name allow-http \
1331+
--priority 1000 \
1332+
--direction Inbound \
1333+
--access Allow \
1334+
--protocol Tcp \
1335+
--destination-port-ranges 80
1336+
```
1337+
1338+
Use [az network nic create](/cli/azure/network/nic?view=azure-cli-latest#az_network_nic_create) to create the network interface.
1339+
1340+
```azurecli-interactive
1341+
az network nic create \
1342+
--resource-group test-rg \
1343+
--name nic-1 \
1344+
--vnet-name vnet-1 \
1345+
--subnet subnet-private \
1346+
--network-security-group nsg-spoke-2
1347+
```
1348+
1349+
Use [az vm create](/cli/azure/vm?view=azure-cli-latest#az_vm_create) to create the Windows Server 2022 virtual machine.
1350+
1351+
```azurecli-interactive
1352+
az vm create \
1353+
--resource-group test-rg \
1354+
--name vm-spoke-2 \
1355+
--image Win2022Datacenter \
1356+
--size Standard_DS2_v2 \
1357+
--admin-username azureuser \
1358+
--nics nic-1
1359+
```
1360+
12841361
---
12851362
12861363
Wait for the virtual machine to finish deploying before continuing to the next steps.
@@ -1328,6 +1405,18 @@ IIS is installed on the Windows Server 2022 virtual machine to test outbound int
13281405
13291406
# [**CLI**](#tab/cli)
13301407
1408+
Use [az vm extension set](/cli/azure/vm/extension?view=azure-cli-latest#az_vm_extension_set) to install IIS on the virtual machine.
1409+
1410+
```azurecli-interactive
1411+
az vm extension set \
1412+
--publisher Microsoft.Compute \
1413+
--version 1.8 \
1414+
--name CustomScriptExtension \
1415+
--vm-name vm-spoke-2 \
1416+
--resource-group test-rg \
1417+
--settings '{"commandToExecute":"powershell Add-WindowsFeature Web-Server; powershell Add-Content -Path \"C:\\inetpub\\wwwroot\\Default.htm\" -Value $($env:computername)"}'
1418+
```
1419+
13311420
---
13321421
13331422
## Test NAT gateway
@@ -1344,7 +1433,7 @@ Obtain the NAT gateway public IP address for verification of the steps later in
13441433
13451434
1. Select **public-ip-nat**.
13461435
1347-
1. Make note of value in **IP address**. The example used in this article is **52.153.224.79**.
1436+
1. Make note of value in **IP address**. The example used in this article is **203.0.113.79**.
13481437
13491438
### Test NAT gateway from spoke one
13501439
@@ -1438,6 +1527,15 @@ Use Microsoft Edge to connect to the web server on **vm-spoke-1** you installed
14381527
14391528
# [**CLI**](#tab/cli)
14401529
1530+
Use [az group delete](/cli/azure/group?view=azure-cli-latest#az_group_delete) to delete the resource group.
1531+
1532+
```azurecli-interactive
1533+
az group delete \
1534+
--name test-rg \
1535+
--yes \
1536+
--no-wait
1537+
```
1538+
14411539
---
14421540
14431541
## Next steps

0 commit comments

Comments
 (0)