You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/load-balancer/load-balancer-multiple-ip-powershell.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -54,7 +54,7 @@ Follow the steps below to achieve the scenario outlined in this article:
54
54
55
55
Then complete [Create a Windows VM](/previous-versions/azure/virtual-machines/scripts/virtual-machines-windows-powershell-sample-create-vm?toc=%2fazure%2fload-balancer%2ftoc.json) steps 6.3 through 6.8.
56
56
57
-
5. Add a second IP configuration to each of the VMs. Follow the instructions in [Assign multiple IP addresses to virtual machines](../virtual-network/ip-services/virtual-network-multiple-ip-addresses-powershell.md#add) article. Use the following configuration settings:
57
+
5. Add a second IP configuration to each of the VMs. Follow the instructions in [Assign multiple IP addresses to virtual machines](../virtual-network/ip-services/virtual-network-multiple-ip-addresses-powershell.md#add-secondary-private-and-public-ip-address) article. Use the following configuration settings:
Use [New-AzPublicIpAddress](/powershell/module/az.network/new-azpublicipaddress) to create a secondary public IP address.
266
+
267
+
```azurepowershell-interactive
268
+
$ip4-2 = @{
269
+
Name = 'myPublicIP-2'
270
+
ResourceGroupName = 'myResourceGroup'
271
+
Location = 'eastus2'
272
+
Sku = 'Standard'
273
+
AllocationMethod = 'Static'
274
+
IpAddressVersion = 'IPv4'
275
+
Zone = 1,2,3
276
+
}
277
+
New-AzPublicIpAddress @ip4-2
278
+
```
279
+
280
+
Use [New-AzNetworkInterfaceIpConfig](/powershell/module/az.network/new-aznetworkinterfaceipconfig) to create the secondary IP configuration for the virtual machine.
281
+
282
+
```azurepowershell-interactive
283
+
## Place the virtual network into a variable. ##
284
+
$net = @{
285
+
Name = 'myVNet'
286
+
ResourceGroupName = 'myResourceGroup'
287
+
}
288
+
$vnet = Get-AzVirtualNetwork @net
289
+
290
+
## Place your virtual network subnet into a variable. ##
291
+
$sub = @{
292
+
Name = 'myBackendSubnet'
293
+
VirtualNetwork = $vnet
294
+
}
295
+
$subnet = Get-AzVirtualNetworkSubnetConfig @sub
296
+
297
+
## Place the secondary public IP address you created previously into a variable. ##
298
+
$pip = @{
299
+
Name = 'myPublicIP-2'
300
+
ResourceGroupName = 'myResourceGroup'
301
+
}
302
+
$pubIP-2 = Get-AzPublicIPAddress @pip
303
+
304
+
## Place the network interface into a variable. ##
305
+
$net = @{
306
+
Name = 'myNIC1'
307
+
ResourceGroupName = 'myResourceGroup'
308
+
}
309
+
$nic = Get-AzNetworkInterface @net
310
+
311
+
## Create secondary configuration for NIC. ##
312
+
$IP2 = @{
313
+
Name = 'ipconfig2'
314
+
Subnet = $vnet.Subnets[0]
315
+
PrivateIpAddressVersion = 'IPv4'
316
+
PrivateIpAddress = '10.1.0.5'
317
+
PublicIPAddress = $pubIP-2
318
+
}
319
+
$IP2Config = New-AzNetworkInterfaceIpConfig @IP2
320
+
321
+
## Add the IP configuration to the network interface. ##
322
+
$nic.IpConfigurations.Add($IP2Config)
323
+
324
+
## Save the configuration to the network interface. ##
0 commit comments