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/virtual-network/ip-services/virtual-network-multiple-ip-addresses-powershell.md
+27-23Lines changed: 27 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,15 @@
1
1
---
2
-
title: Multiple IP addresses for Azure virtual machines - Azure PowerShell
2
+
title: Assign multiple IP addresses to VMs - Azure PowerShell
3
3
titleSuffix: Azure Virtual Network
4
4
description: Learn how to create a virtual machine with multiple IP addresses with Azure PowerShell.
5
5
services: virtual-network
6
6
author: asudbring
7
7
ms.service: virtual-network
8
8
ms.subservice: ip-services
9
9
ms.topic: how-to
10
-
ms.date: 09/09/2022
10
+
ms.date: 12/12/2022
11
11
ms.author: allensu
12
+
ms.custom: template-how-to, engagement-fy23
12
13
---
13
14
14
15
# Assign multiple IP addresses to virtual machines using Azure PowerShell
@@ -23,34 +24,31 @@ Assigning multiple IP addresses to a VM enables the following capabilities:
23
24
24
25
* 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).
25
26
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).
27
28
28
29
> [!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).
30
31
31
32
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.
32
33
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.
34
35
35
36
## Prerequisites
36
37
37
38
- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
38
39
39
-
- Azure PowerShell installed locally or Azure Cloud Shell.
40
+
-PowerShell environment in [Azure Cloud Shell](https://shell.azure.com/powershell) or Azure PowerShell installed locally. To learn more about using PowerShell in Azure Cloud Shell, see [Azure Cloud Shell Quickstart - PowerShell](../../cloud-shell/quickstart-powershell.md).
40
41
41
-
- Sign in to Azure PowerShell and ensure you've selected the subscription with which you want to use this feature. For more information, see [Sign in with Azure PowerShell](/powershell/azure/authenticate-azureps).
42
-
43
-
- 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
44
-
-Name "Az. Network" if necessary.
42
+
- 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). 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 -Name "Az.Network"` if necessary.
45
43
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.
44
+
- Sign in to Azure PowerShell and ensure you've selected the subscription with which you want to use this feature. For more information, see [Sign in with Azure PowerShell](/powershell/azure/authenticate-azureps).
47
45
48
46
> [!NOTE]
49
47
> 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).
50
48
51
49
:::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.":::
52
50
53
-
*Figure: Diagram of network configuration resources created in How-to article.*
51
+
*Figure: Diagram of network configuration resources created in this How-to article.*
54
52
55
53
## Create a resource group
56
54
@@ -70,7 +68,7 @@ New-AzResourceGroup @rg
70
68
71
69
In this section, you'll create a virtual network for the virtual machine.
72
70
73
-
Use [New-AzVirtualNetwork](/powershell/module/az.network/new-azvirtualnetwork) and [New-AzVirtualNetworkSubnetConfig](/powershell/module/az.network/new-azvirtualnetworksubnetconfig) to create a virtual network.
71
+
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.
Use [New-AzPublicIpAddress](/powershell/module/az.network/new-azpublicipaddress) to create a primary public IP address.
98
96
@@ -141,9 +139,9 @@ $nsg = @{
141
139
New-AzNetworkSecurityGroup @nsg
142
140
```
143
141
144
-
###Create network interface
142
+
## Create a network interface
145
143
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.
144
+
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.
147
145
148
146
```azurepowershell-interactive
149
147
## Place the virtual network into a variable. ##
@@ -167,7 +165,7 @@ $pub1 = @{
167
165
}
168
166
$pubIP1 = Get-AzPublicIPAddress @pub1
169
167
170
-
## Create primary configuration for NIC. ##
168
+
## Create a primary IP configuration for the network interface. ##
0 commit comments