Skip to content

Commit 487aaad

Browse files
committed
freshness
1 parent 8430844 commit 487aaad

File tree

1 file changed

+25
-18
lines changed

1 file changed

+25
-18
lines changed

articles/virtual-network/ip-services/virtual-network-multiple-ip-addresses-powershell.md

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
---
2-
title: Multiple IP addresses for Azure virtual machines - Azure PowerShell
2+
title: Assign multiple IP addresses to VMs - Azure PowerShell
33
titleSuffix: Azure Virtual Network
44
description: Learn how to create a virtual machine with multiple IP addresses with Azure PowerShell.
55
services: virtual-network
66
author: asudbring
77
ms.service: virtual-network
88
ms.subservice: ip-services
99
ms.topic: how-to
10-
ms.date: 09/09/2022
10+
ms.date: 12/12/2022
1111
ms.author: allensu
12+
ms.custom: template-how-to, engagement-fy23
1213
---
1314

1415
# Assign multiple IP addresses to virtual machines using Azure PowerShell
@@ -23,14 +24,14 @@ Assigning multiple IP addresses to a VM enables the following capabilities:
2324

2425
* The ability to add any of the private IP addresses for any of the NICs to an Azure Load Balancer back-end pool. In the past, only the primary IP address for the primary NIC could be added to a back-end pool. For more information about load balancing multiple IP configurations, see [Load balancing multiple IP configurations](../../load-balancer/load-balancer-multiple-ip.md?toc=%2fazure%2fvirtual-network%2ftoc.json).
2526

26-
Every NIC attached to a VM has one or more IP configurations associated to it. Each configuration is assigned one static or dynamic private IP address. Each configuration may also have one public IP address resource associated to it. To learn more about IP addresses in Azure, read the [IP addresses in Azure](../../virtual-network/ip-services/public-ip-addresses.md) article.
27+
Every NIC attached to a VM has one or more IP configurations associated to it. Each configuration is assigned one static or dynamic private IP address. Each configuration may also have one public IP address resource associated to it. To learn more about IP addresses in Azure, see [IP addresses in Azure](../../virtual-network/ip-services/public-ip-addresses.md).
2728

2829
> [!NOTE]
29-
> All IP configurations on a single NIC must be associated to the same subnet. If multiple IPs on different subnets are desired, multiple NICs on a VM can be used. To learn more about multiple NICs on a VM in Azure, read the [Create VM with Multiple NICs](../../virtual-machines/windows/multiple-nics.md) article.
30+
> All IP configurations on a single NIC must be associated to the same subnet. If multiple IPs on different subnets are desired, multiple NICs on a VM can be used. To learn more about multiple NICs on a VM in Azure, see [Create VM with Multiple NICs](../../virtual-machines/windows/multiple-nics.md).
3031
3132
There's a limit to how many private IP addresses can be assigned to a NIC. There's also a limit to how many public IP addresses that can be used in an Azure subscription. See the [Azure limits](../../azure-resource-manager/management/azure-subscription-service-limits.md?toc=%2fazure%2fvirtual-network%2ftoc.json#azure-resource-manager-virtual-networking-limits) article for details.
3233

33-
This article explains how to add multiple IP addresses to a virtual machine using the Azure portal.
34+
This article explains how to add multiple IP addresses to a virtual machine using PowerShell.
3435

3536
## Prerequisites
3637

@@ -43,14 +44,14 @@ This article explains how to add multiple IP addresses to a virtual machine usin
4344
- Ensure your Az. Network module is 4.3.0 or later. To verify the installed module, use the command Get-InstalledModule -Name "Az.Network". If the module requires an update, use the command Update-Module
4445
-Name "Az. Network" if necessary.
4546

46-
If you choose to install and use PowerShell locally, this article requires the Azure PowerShell module version 5.4.1 or later. Run `Get-Module -ListAvailable Az` to find the installed version. If you need to upgrade, see [Install Azure PowerShell module](/powershell/azure/install-Az-ps). If you're running PowerShell locally, you also need to run `Connect-AzAccount` to create a connection with Azure.
47+
If you choose to install and use PowerShell locally, this article requires the Azure PowerShell module version 5.4.1 or later. Run `Get-InstalledModule -Name Az` to find the installed version. If you need to upgrade, see [Install Azure PowerShell module](/powershell/azure/install-Az-ps). If you're running PowerShell locally, you also need to run `Connect-AzAccount` to create a connection with Azure.
4748

4849
> [!NOTE]
4950
> Though the steps in this article assigns all IP configurations to a single NIC, you can also assign multiple IP configurations to any NIC in a multi-NIC VM. To learn how to create a VM with multiple NICs, see [Create a VM with multiple NICs](../../virtual-machines/windows/multiple-nics.md).
5051
5152
:::image type="content" source="./media/virtual-network-multiple-ip-addresses-portal/multiple-ipconfigs.png" alt-text="Diagram of network configuration resources created in How-to article.":::
5253

53-
*Figure: Diagram of network configuration resources created in How-to article.*
54+
*Figure: Diagram of network configuration resources created in this How-to article.*
5455

5556
## Create a resource group
5657

@@ -70,7 +71,7 @@ New-AzResourceGroup @rg
7071

7172
In this section, you'll create a virtual network for the virtual machine.
7273

73-
Use [New-AzVirtualNetwork](/powershell/module/az.network/new-azvirtualnetwork) and [New-AzVirtualNetworkSubnetConfig](/powershell/module/az.network/new-azvirtualnetworksubnetconfig) to create a virtual network.
74+
Use [New-AzVirtualNetwork](/powershell/module/az.network/new-azvirtualnetwork) and [New-AzVirtualNetworkSubnetConfig](/powershell/module/az.network/new-azvirtualnetworksubnetconfig) to create a virtual network with one subnet.
7475

7576
```azurepowershell-interactive
7677
## Create backend subnet config ##
@@ -81,18 +82,18 @@ $subnet = @{
8182
$subnetConfig = New-AzVirtualNetworkSubnetConfig @subnet
8283
8384
## Create the virtual network ##
84-
$net = @{
85+
$vnet = @{
8586
Name = 'myVNet'
8687
ResourceGroupName = 'myResourceGroup'
8788
Location = 'eastus2'
8889
AddressPrefix = '10.1.0.0/16'
8990
Subnet = $subnetConfig
9091
}
91-
New-AzVirtualNetwork @net
92+
New-AzVirtualNetwork @vnet
9293
9394
```
9495

95-
## Create primary public IP address
96+
## Create a primary public IP address
9697

9798
Use [New-AzPublicIpAddress](/powershell/module/az.network/new-azpublicipaddress) to create a primary public IP address.
9899

@@ -141,9 +142,9 @@ $nsg = @{
141142
New-AzNetworkSecurityGroup @nsg
142143
```
143144

144-
### Create network interface
145+
## Create a network interface
145146

146-
You'll use [New-AzNetworkInterface](/powershell/module/az.network/new-aznetworkinterface) and [New-AzNetworkInterfaceIpConfig](/powershell/module/az.network/new-aznetworkinterfaceipconfig) to create the network interface for the virtual machine. The public IP addresses and the NSG created previously are associated with the NIC. The network interface is attached to the virtual network you created previously.
147+
Use [New-AzNetworkInterface](/powershell/module/az.network/new-aznetworkinterface) and [New-AzNetworkInterfaceIpConfig](/powershell/module/az.network/new-aznetworkinterfaceipconfig) to create a network interface (NIC) for the virtual machine. The public IP address and network security group created previously are associated with the network interface. The network interface is attached to the virtual network you created previously.
147148

148149
```azurepowershell-interactive
149150
## Place the virtual network into a variable. ##
@@ -167,7 +168,7 @@ $pub1 = @{
167168
}
168169
$pubIP1 = Get-AzPublicIPAddress @pub1
169170
170-
## Create primary configuration for NIC. ##
171+
## Create a primary IP configuration for the network interface. ##
171172
$IP1 = @{
172173
Name = 'ipconfig1'
173174
Subnet = $vnet.Subnets[0]
@@ -176,7 +177,7 @@ $IP1 = @{
176177
}
177178
$IP1Config = New-AzNetworkInterfaceIpConfig @IP1 -Primary
178179
179-
## Create tertiary configuration for NIC. ##
180+
## Create a secondary IP configuration for the network interface. ##
180181
$IP3 = @{
181182
Name = 'ipconfig3'
182183
Subnet = $vnet.Subnets[0]
@@ -185,7 +186,7 @@ $IP3 = @{
185186
}
186187
$IP3Config = New-AzNetworkInterfaceIpConfig @IP3
187188
188-
## Command to create network interface for VM ##
189+
## Command to create a network interface. ##
189190
$nic = @{
190191
Name = 'myNIC1'
191192
ResourceGroupName = 'myResourceGroup'
@@ -199,7 +200,7 @@ New-AzNetworkInterface @nic
199200
> [!NOTE]
200201
> When adding a static IP address, you must specify an unused, valid address on the subnet the NIC is connected to.
201202
202-
### Create virtual machine
203+
## Create a virtual machine
203204

204205
Use the following commands to create the virtual machine:
205206

@@ -301,7 +302,7 @@ $net = @{
301302
}
302303
$nic = Get-AzNetworkInterface @net
303304
304-
## Create secondary configuration for NIC. ##
305+
## Create a secondary IP configuration for the network interface. ##
305306
$IPc2 = @{
306307
Name = 'ipconfig2'
307308
Subnet = $vnet.Subnets[0]
@@ -319,3 +320,9 @@ $nic | Set-AzNetworkInterface
319320
```
320321

321322
[!INCLUDE [virtual-network-multiple-ip-addresses-os-config.md](../../../includes/virtual-network-multiple-ip-addresses-os-config.md)]
323+
324+
## Next steps
325+
326+
- Learn more about [public IP addresses](public-ip-addresses.md) in Azure.
327+
- Learn more about [private IP addresses](private-ip-addresses.md) in Azure.
328+
- Learn how to [Configure IP addresses for an Azure network interface](virtual-network-network-interface-addresses.md?tabs=nic-address-powershell).

0 commit comments

Comments
 (0)