|
| 1 | +--- |
| 2 | +title: Upgrade an IPv4 application to IPv6 in Azure Virtual Network - PowerShell |
| 3 | +titlesuffix: Azure Virtual Network |
| 4 | +description: This article shows how to deploy IPv6 addresses to an existing application in Azure virtual network using Azure Powershell. |
| 5 | +services: virtual-network |
| 6 | +documentationcenter: na |
| 7 | +author: KumudD |
| 8 | +manager: twooley |
| 9 | +ms.service: virtual-network |
| 10 | +ms.devlang: na |
| 11 | +ms.topic: article |
| 12 | +ms.tgt_pltfrm: na |
| 13 | +ms.workload: infrastructure-services |
| 14 | +ms.date: 10/21/2019 |
| 15 | +ms.author: kumud |
| 16 | +--- |
| 17 | + |
| 18 | +# Upgrade an IPv4 application to IPv6 in Azure virtual network - PowerShell (Preview) |
| 19 | + |
| 20 | +This article shows you how to an application using IPv4 public IP address to use an IPv6 address in an Azure virtual network for a Standard Load Balancer. The in-place upgrade includes a virtual network and subnet, a Standard Load Balancer with IPv4 + IPV6 frontend configurations, VMs with NICs that have a IPv4 + IPv6 configurations, network security group, and public IPs. |
| 21 | + |
| 22 | +> [!Important] |
| 23 | +> IPv6 support for Azure Virtual Network is currently in public preview. This preview is provided without a service level agreement and is not recommended for production workloads. Certain features may not be supported or may have constrained capabilities. See the [Supplemental Terms of Use for Microsoft Azure Previews](https://azure.microsoft.com/support/legal/preview-supplemental-terms/) for details. |
| 24 | +
|
| 25 | +[!INCLUDE [cloud-shell-try-it.md](../../includes/cloud-shell-try-it.md)] |
| 26 | + |
| 27 | +If you choose to install and use PowerShell locally, this article requires the Azure PowerShell module version 6.9.0 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 are running PowerShell locally, you also need to run `Connect-AzAccount` to create a connection with Azure. |
| 28 | + |
| 29 | +## Prerequisites |
| 30 | + |
| 31 | +### Register the service |
| 32 | + |
| 33 | +Before you deploy a dual stack application in Azure, you must configure your subscription for this preview feature using the following Azure PowerShell: |
| 34 | + |
| 35 | +Register as follows: |
| 36 | +```azurepowershell |
| 37 | +Register-AzProviderFeature -FeatureName AllowIPv6VirtualNetwork -ProviderNamespace Microsoft.Network |
| 38 | +Register-AzProviderFeature -FeatureName AllowIPv6CAOnStandardLB -ProviderNamespace Microsoft.Network |
| 39 | +``` |
| 40 | +It takes up to 30 minutes for feature registration to complete. You can check your registration status by running the following Azure PowerShell command: |
| 41 | +Check on the registration as follows: |
| 42 | +```azurepowershell |
| 43 | +Get-AzProviderFeature -FeatureName AllowIPv6VirtualNetwork -ProviderNamespace Microsoft.Network |
| 44 | +Get-AzProviderFeature -FeatureName AllowIPv6CAOnStandardLB -ProviderNamespace Microsoft.Network |
| 45 | +``` |
| 46 | +After the registration is complete, run the following command: |
| 47 | + |
| 48 | +```azurepowershell |
| 49 | +Register-AzResourceProvider -ProviderNamespace Microsoft.Network |
| 50 | +``` |
| 51 | + |
| 52 | +### Create a Standard Load Balancer |
| 53 | +This article assumes that you deployed a Standard Load Balancer as described in [Quickstart: Create a Standard Load Balancer - Azure PowerShell](../load-balancer/quickstart-create-standard-load-balancer-powershell.md). |
| 54 | + |
| 55 | +## Retrieve the resource group |
| 56 | + |
| 57 | +Before you can create your dual-stack virtual network, you must retrieve the resource group with [Get-AzResourceGroup](/powershell/module/az.resources/get-azresourcegroup). |
| 58 | + |
| 59 | +```azurepowershell |
| 60 | + $rg = Get-AzResourceGroup -ResourceGroupName "myResourceGroupSLB" |
| 61 | +``` |
| 62 | + |
| 63 | +## Create an IPv6 IP addresses |
| 64 | + |
| 65 | +Create public IPv6 address with [New-AzPublicIpAddress](/powershell/module/az.network/new-azpublicipaddress) for your Standard Load Balancer. The following example creates an IPv6 public IP address named *PublicIP_v6* in the *myResourceGroupSLB* resource group: |
| 66 | + |
| 67 | +```azurepowershell |
| 68 | + |
| 69 | + $PublicIP_v6 = New-AzPublicIpAddress ` |
| 70 | + -Name "PublicIP_v6" ` |
| 71 | + -ResourceGroupName $rg.ResourceGroupName ` |
| 72 | + -Location $rg.Location ` |
| 73 | + -Sku Standard ` |
| 74 | + -AllocationMethod Static ` |
| 75 | + -IpAddressVersion IPv6 |
| 76 | +``` |
| 77 | + |
| 78 | +## Configure load balancer frontend |
| 79 | + |
| 80 | +Retrieve the existing load balancer configuration and then configure it with the new IPv6 IP address using [Add-AzLoadBalancerFrontendIpConfig](/powershell/module/az.network/Add-AzLoadBalancerFrontendIpConfig) as follows: |
| 81 | + |
| 82 | +```azurepowershell |
| 83 | +# Retrieve the load balancer configuration |
| 84 | +$lb = Get-AzLoadBalancer -ResourceGroupName $rg.ResourceGroupName -Name "MyLoadBalancer" |
| 85 | +# Add IPv6 components to the local copy of the load balancer configuration |
| 86 | +$lb | Add-AzLoadBalancerFrontendIpConfig ` |
| 87 | + -Name "dsLbFrontEnd_v6" ` |
| 88 | + -PublicIpAddress $PublicIP_v6 |
| 89 | +#Update the running load balancer with the new frontend |
| 90 | +$lb | Set-AzLoadBalancer |
| 91 | +``` |
| 92 | + |
| 93 | +## Configure load balancer backend pool |
| 94 | + |
| 95 | +Create the backend pool on the local copy of the load balancer configuration and update the running load balancer with the new backend pool configuration as follows: |
| 96 | + |
| 97 | +```azurepowershell |
| 98 | +$lb | Add-AzLoadBalancerBackendAddressPoolConfig -Name "LbBackEndPool_v6" |
| 99 | +# Update the running load balancer with the new backend pool |
| 100 | +$lb | Set-AzLoadBalancer |
| 101 | +``` |
| 102 | + |
| 103 | +## Configure load balancer rules |
| 104 | +Retrieve the existing load balancer frontend and backend pool configuration and then add new load-balancing rules using [Add-AzLoadBalancerRuleConfig](/powershell/module/az.network/Add-AzLoadBalancerRuleConfig). |
| 105 | + |
| 106 | +```azurepowershell |
| 107 | +# Retrieve the updated (live) versions of the frontend and backend pool |
| 108 | +$frontendIPv6 = Get-AzLoadBalancerFrontendIpConfig -Name "dsLbFrontEnd_v6" -LoadBalancer $lb |
| 109 | +$backendPoolv6 = Get-AzLoadBalancerBackendAddressPoolConfig -Name "LbBackEndPool_v6" -LoadBalancer $lb |
| 110 | +# Create new LB rule with the frontend and backend |
| 111 | +$lb | Add-AzLoadBalancerRuleConfig ` |
| 112 | + -Name "dsLBrule_v6" ` |
| 113 | + -FrontendIpConfiguration $frontendIPv6 ` |
| 114 | + -BackendAddressPool $backendPoolv6 ` |
| 115 | + -Protocol Tcp ` |
| 116 | + -FrontendPort 80 ` |
| 117 | + -BackendPort 80 |
| 118 | +#Finalize all the load balancer updates on the running load balancer |
| 119 | +$lb | Set-AzLoadBalancer |
| 120 | +``` |
| 121 | +## Add IPv6 address ranges |
| 122 | + |
| 123 | +Add IPv6 address ranges to the virtual network and subnet hosting the load balancer as follows: |
| 124 | + |
| 125 | +```azurepowershell |
| 126 | +#Add IPv6 ranges to the VNET and subnet |
| 127 | +#Retreive the VNET object |
| 128 | +$vnet = Get-AzVirtualNetwork -ResourceGroupName $rg.ResourceGroupName -Name "myVnet" |
| 129 | +#Add IPv6 prefix to the VNET |
| 130 | +$vnet.addressspace.addressprefixes.add("ace:cab:deca::/48") |
| 131 | +#Update the running VNET |
| 132 | +$vnet | Set-AzVirtualNetwork |
| 133 | +
|
| 134 | +#Retrieve the subnet object from the local copy of the VNET |
| 135 | +$subnet= $vnet.subnets[0] |
| 136 | +#Add IPv6 prefix to the Subnet (subnet of the VNET prefix, of course) |
| 137 | +$subnet.addressprefix.add("ace:cab:deca::/64") |
| 138 | +#Update the running VNET with the new subnet configuration |
| 139 | +$vnet | Set-AzVirtualNetwork |
| 140 | +
|
| 141 | +``` |
| 142 | +## Add IPv6 configuration to NIC |
| 143 | + |
| 144 | +Configure both of the VM NICs with an IPv6 address using [Add-AzNetworkInterfaceIpConfig](/powershell/module/az.network/Add-AzNetworkInterfaceIpConfig) as follows: |
| 145 | + |
| 146 | +```azurepowershell |
| 147 | +
|
| 148 | +#Retrieve the NIC objects |
| 149 | +$NIC_1 = Get-AzNetworkInterface -Name "myNic1" -ResourceGroupName $rg.ResourceGroupName |
| 150 | +$NIC_2 = Get-AzNetworkInterface -Name "myNic2" -ResourceGroupName $rg.ResourceGroupName |
| 151 | +$NIC_3 = Get-AzNetworkInterface -Name "myNic3" -ResourceGroupName $rg.ResourceGroupName |
| 152 | +#Add an IPv6 IPconfig to NIC_1 and update the NIC on the running VM |
| 153 | +$NIC_1 | Add-AzNetworkInterfaceIpConfig -Name MyIPv6Config -Subnet $vnet.Subnets[0] -PrivateIpAddressVersion IPv6 -LoadBalancerBackendAddressPool $backendPoolv6 |
| 154 | +$NIC_1 | Set-AzNetworkInterface |
| 155 | +#Add an IPv6 IPconfig to NIC_2 and update the NIC on the running VM |
| 156 | +$NIC_2 | Add-AzNetworkInterfaceIpConfig -Name MyIPv6Config -Subnet $vnet.Subnets[0] -PrivateIpAddressVersion IPv6 -LoadBalancerBackendAddressPool $backendPoolv6 |
| 157 | +$NIC_2 | Set-AzNetworkInterface |
| 158 | +#Add an IPv6 IPconfig to NIC_3 and update the NIC on the running VM |
| 159 | +$NIC_3 | Add-AzNetworkInterfaceIpConfig -Name MyIPv6Config -Subnet $vnet.Subnets[0] -PrivateIpAddressVersion IPv6 -LoadBalancerBackendAddressPool $backendPoolv6 |
| 160 | +$NIC_3 | Set-AzNetworkInterface |
| 161 | +
|
| 162 | +``` |
| 163 | + |
| 164 | +## View IPv6 dual stack virtual network in Azure portal |
| 165 | +You can view the IPv6 dual stack virtual network in Azure portal as follows: |
| 166 | +1. In the portal's search bar, enter *myVnet*. |
| 167 | +2. When **myVnet** appears in the search results, select it. This launches the **Overview** page of the dual stack virtual network named *myVNet*. The dual stack virtual network shows the three NICs with both IPv4 and IPv6 configurations located in the dual stack subnet named *mySubnet*. |
| 168 | + |
| 169 | +  |
| 170 | + |
| 171 | +> [!NOTE] |
| 172 | +> The IPv6 for Azure virtual network is available in the Azure portal in read-only for this preview release. |
| 173 | +
|
| 174 | +## Clean up resources |
| 175 | + |
| 176 | +When no longer needed, you can use the [Remove-AzResourceGroup](/powershell/module/az.resources/remove-azresourcegroup) command to remove the resource group, VM, and all related resources. |
| 177 | + |
| 178 | +```azurepowershell-interactive |
| 179 | +Remove-AzResourceGroup -Name MyAzureResourceGroupSLB |
| 180 | +``` |
| 181 | + |
| 182 | +## Next steps |
| 183 | + |
| 184 | +In this article, you updated an existing Standard Load Balancer with a IPv4 frontend IP configuration to a dual stack (IPv4 and IPv6) configuration. You also added IPv6 configurations to the NICs of the VMs in the backend pool. To learn more about IPv6 support in Azure virtual networks, see [What is IPv6 for Azure Virtual Network?](ipv6-overview.md) |
0 commit comments