Skip to content

Commit 83bccd1

Browse files
authored
Merge pull request #104640 from asudbring/release-preview-nat
Changes post merge of release branch
2 parents 6afb679 + 84a6ab3 commit 83bccd1

File tree

1 file changed

+45
-45
lines changed

1 file changed

+45
-45
lines changed

articles/virtual-network/quickstart-create-nat-gateway-powershell.md

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ New-AzPublicIpAddress -Name $pbnm -ResourceGroupName $rsg -AllocationMethod Stat
7474

7575
### Create a public IP prefix
7676

77-
Use [New-AzPublicIpPrefix](https://docs.microsoft.com/powershell/module/az.network/new-azpublicipprefix?view=latest) to create a public IP prefix resource named **myPublicIPprefix** in **myResourceGroupNAT**. The result of this command will be stored in a variable named **$publicIPPrefix** for later use.
77+
Use [New-AzPublicIpPrefix](https://docs.microsoft.com/powershell/module/az.network/new-azpublicipprefix?view=latest) to create a public IP prefix resource named **myPublicIPprefix** in **myResourceGroupNAT**. The result of this command will be stored in a variable named **$publicIPPrefix** for later use.
7878

7979
```azurepowershell-interactive
8080
$rsg = 'myResourceGroupNAT'
@@ -112,18 +112,18 @@ Create the virtual network and associate the subnet to the gateway.
112112
Create a virtual network named **myVnet** with a subnet named **mySubnet** using [New-AzVirtualNetworkSubnetConfig](https://docs.microsoft.com/powershell/module/az.network/new-azvirtualnetworksubnetconfig?view=latest) in the **myResourceGroup** using [New-AzVirtualNetwork](https://docs.microsoft.com/powershell/module/az.network/new-azvirtualnetwork?view=latest). The IP address space for the virtual network is **192.168.0.0/16**. The subnet within the virtual network is **192.168.0.0/24**. The result of the commands will be stored in variables named **$subnet** and **$vnet** for later use.
113113

114114
```azurepowershell-interactive
115-
$sbnm = 'mySubnet'
116-
$vnnm = 'myVnet'
117-
$rsg = 'myResourceGroupNAT'
118-
$loc = 'eastus2'
119-
$pfxsub = '192.168.0.0/24'
120-
$pfxvn = '192.168.0.0/16'
121-
122-
$subnet =
123-
New-AzVirtualNetworkSubnetConfig -Name $sbnm -AddressPrefix $pfxsub -NatGateway $natGateway
124-
125-
$vnet =
126-
New-AzVirtualNetwork -Name $vnnm -ResourceGroupName $rsg -Location $loc -AddressPrefix $pfxvn -Subnet $subnet
115+
$sbnm = 'mySubnet'
116+
$vnnm = 'myVnet'
117+
$rsg = 'myResourceGroupNAT'
118+
$loc = 'eastus2'
119+
$pfxsub = '192.168.0.0/24'
120+
$pfxvn = '192.168.0.0/16'
121+
122+
$subnet =
123+
New-AzVirtualNetworkSubnetConfig -Name $sbnm -AddressPrefix $pfxsub -NatGateway $natGateway
124+
125+
$vnet =
126+
New-AzVirtualNetwork -Name $vnnm -ResourceGroupName $rsg -Location $loc -AddressPrefix $pfxvn -Subnet $subnet
127127
```
128128

129129
All outbound traffic to Internet destinations is now using the NAT service. It isn't necessary to configure a UDR.
@@ -137,49 +137,49 @@ We'll now create a VM to use the NAT service. This VM has a public IP to use as
137137
We create a public IP to be used to access the VM. Use [New-AzPublicIpAddress](https://docs.microsoft.com/powershell/module/az.network/new-azpublicipaddress?view=latest) to create a public IP address resource named **myPublicIPVM** in **myResourceGroupNAT**. The result of this command will be stored in a variable named **$publicIpVM** for later use.
138138

139139
```azurepowershell-interactive
140-
$rsg = 'myResourceGroupNAT'
141-
$loc = 'eastus2'
142-
$ipnm = 'myPublicIPVM'
143-
$sku = 'Standard'
140+
$rsg = 'myResourceGroupNAT'
141+
$loc = 'eastus2'
142+
$ipnm = 'myPublicIPVM'
143+
$sku = 'Standard'
144144
145-
$publicIpVM =
146-
New-AzPublicIpAddress -Name $ipnm -ResourceGroupName $rsg -AllocationMethod Static -Location $loc -Sku $sku
145+
$publicIpVM =
146+
New-AzPublicIpAddress -Name $ipnm -ResourceGroupName $rsg -AllocationMethod Static -Location $loc -Sku $sku
147147
```
148148

149149
### Create an NSG and expose SSH endpoint for VM
150150

151151
Standard public IP addresses are 'secure by default', we need to create an NSG to allow inbound access for ssh. Use [New-AzNetworkSecurityGroup](https://docs.microsoft.com/powershell/module/az.network/new-aznetworksecuritygroup?view=latest) to create an NSG resource named **myNSG**. Use [New-AzNetworkSecurityRuleConfig](https://docs.microsoft.com/powershell/module/az.network/new-aznetworksecurityruleconfig?view=latest) to create an NSG rule for SSH access named **ssh** in **myResourceGroupNAT**. The result of this command will be stored in a variable named **$nsg** for later use.
152152

153153
```azurepowershell-interactive
154-
$rnm = 'ssh'
155-
$rdesc = 'SSH access'
156-
$acc = 'Allow'
157-
$pro = 'Tcp'
158-
$dir = 'Inbound'
159-
$pri = '100'
160-
$prt = '22'
161-
$rsg = 'myResourceGroupNAT'
162-
$rnm = 'myNSG'
163-
$loc = 'eastus2'
164-
165-
$sshrule =
166-
New-AzNetworkSecurityRuleConfig -Name $rnm -Description $rdesc -Access $acc -Protocol $pro -Direction $dir -Priority $pri -SourceAddressPrefix * -SourcePortRange * -DestinationAddressPrefix * -DestinationPortRange $prt
167-
168-
$nsg =
169-
New-AzNetworkSecurityGroup -ResourceGroupName $rsg -Name $rnm -Location $loc -SecurityRules $sshrule
154+
$rnm = 'ssh'
155+
$rdesc = 'SSH access'
156+
$acc = 'Allow'
157+
$pro = 'Tcp'
158+
$dir = 'Inbound'
159+
$pri = '100'
160+
$prt = '22'
161+
$rsg = 'myResourceGroupNAT'
162+
$rnm = 'myNSG'
163+
$loc = 'eastus2'
164+
165+
$sshrule =
166+
New-AzNetworkSecurityRuleConfig -Name $rnm -Description $rdesc -Access $acc -Protocol $pro -Direction $dir -Priority $pri -SourceAddressPrefix * -SourcePortRange * -DestinationAddressPrefix * -DestinationPortRange $prt
167+
168+
$nsg =
169+
New-AzNetworkSecurityGroup -ResourceGroupName $rsg -Name $rnm -Location $loc -SecurityRules $sshrule
170170
```
171171

172172
### Create NIC for VM
173173

174174
Create a network interface with [New-AzNetworkInterface](https://docs.microsoft.com/powershell/module/az.network/new-aznetworkinterface?view=azps-2.8.0) named **myNic**. This command associates the Public IP address and the network security group. The result of this command will be stored in a variable named **$nic** for later use.
175175

176176
```azurepowershell-interactive
177-
$rsg = 'myResourceGroupNAT'
178-
$nmn = 'myNic'
179-
$loc = 'eastus2'
177+
$rsg = 'myResourceGroupNAT'
178+
$nmn = 'myNic'
179+
$loc = 'eastus2'
180180
181-
$nic =
182-
New-AzNetworkInterface -ResourceGroupName $rsg -Name $nmn -NetworkSecurityGroupID $nsg.Id -PublicIPAddressID $publicIPVM.Id -SubnetID $vnet.Subnets[0].Id -Location $loc
181+
$nic =
182+
New-AzNetworkInterface -ResourceGroupName $rsg -Name $nmn -NetworkSecurityGroupID $nsg.Id -PublicIPAddressID $publicIPVM.Id -SubnetID $vnet.Subnets[0].Id -Location $loc
183183
```
184184

185185
### Create VM
@@ -204,7 +204,7 @@ To create a VM in PowerShell, you create a configuration that has settings for t
204204
Define the SSH credentials, OS information, and VM size. In this example, the SSH key is stored in ~/.ssh/id_rsa.pub.
205205

206206
```azurepowershell-interactive
207-
# Define a credential object
207+
#Define a credential object
208208
209209
$securePassword =
210210
ConvertTo-SecureString ' ' -AsPlainText -Force
@@ -253,10 +253,10 @@ Wait for the VM to prepare to deploy then continue with the rest of the steps.
253253
First we need to discover the IP address of the VM you've created. To get the public IP address of the VM, use [Get-AzPublicIpAddress](https://docs.microsoft.com/powershell/module/az.network/get-azpublicipaddress?view=latest).
254254

255255
```azurepowershell-interactive
256-
$rsg = 'myResourceGroupNAT'
257-
$nmn = 'myPublicIPVM'
256+
$rsg = 'myResourceGroupNAT'
257+
$nmn = 'myPublicIPVM'
258258
259-
Get-AzPublicIpAddress -ResourceGroupName $rsg -Name $nmn | select IpAddress
259+
Get-AzPublicIpAddress -ResourceGroupName $rsg -Name $nmn | select IpAddress
260260
```
261261

262262
>[!IMPORTANT]
@@ -277,7 +277,7 @@ You're now ready to use the NAT service.
277277
When no longer needed, you can use the [Remove-AzResourceGroup](https://docs.microsoft.com/powershell/module/az.resources/remove-azresourcegroup?view=latest) command to remove the resource group and all resources contained within.
278278

279279
```azurepowershell-interactive
280-
Remove-AzResourceGroup -Name myResourceGroupNAT
280+
Remove-AzResourceGroup -Name myResourceGroupNAT
281281
```
282282

283283
## Next steps

0 commit comments

Comments
 (0)