Skip to content

Commit d6348ec

Browse files
committed
add posh article for Lb vmss
1 parent 0264e26 commit d6348ec

File tree

1 file changed

+85
-0
lines changed

1 file changed

+85
-0
lines changed
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
---
2+
title: Configure virtual machine scale set with an existing Azure Load Balancer - Azure PowerShell
3+
description: Learn how to configure a virtual machine scale set with an existing Azure Load Balancer.
4+
author: asudbring
5+
ms.author: allensu
6+
ms.service: load-balancer
7+
ms.topic: article
8+
ms.date: 03/26/2020
9+
---
10+
11+
# Configure a virtual machine scale set with an existing Azure Load Balancer using the Azure PowerShell
12+
13+
In this article, you'll learn how to configure a virtual machine scale set with an existing Azure Load Balancer.
14+
15+
## Prerequisites
16+
17+
- An Azure subscription.
18+
- An existing Azure Load Balancer in the subscription where the virtual machine scale set will be deployed.
19+
- An Azure Virtual Network for the virtual machine scale set.
20+
21+
[!INCLUDE [cloud-shell-try-it.md](../../includes/cloud-shell-try-it.md)]
22+
23+
[!INCLUDE [updated-for-az](../../includes/updated-for-az.md)]
24+
25+
## Sign in to Azure CLI
26+
27+
Sign into Azure.
28+
29+
```azurepowershell-interactive
30+
Connect-AzAccount
31+
```
32+
33+
## Deploy a virtual machine scale set with existing load balancer
34+
35+
Replace the values in brackets with the names of the resources in your configuration.
36+
37+
```azurepowershell-interactive
38+
39+
$rsg = <resource-group>
40+
$loc = <location>
41+
$vms = <vm-scale-set-name>
42+
$vnt = <virtual-network>
43+
$sub = <subnet-name>
44+
$lbn = <load-balancer-name>
45+
$pol = <upgrade-policy-mode>
46+
47+
$lb = Get-AzLoadBalancer -ResourceGroupName $rsg -Name $lbn
48+
49+
New-AzVmss -ResourceGroupName $rsg -Location $loc -VMScaleSetName $vms -VirtualNetworkName $vnt -SubnetName $sub -LoadBalancerName $lb -UpgradePolicyMode $pol
50+
51+
```
52+
53+
The below example deploys a virtual machine scale set with:
54+
55+
- Virtual machine scale set named **myVMSS**
56+
- Azure Load Balancer named **myLoadBalancer**
57+
- Load balancer backend pool named **myBackendPool**
58+
- Azure Virtual Network named **myVnet**
59+
- Subnet named **mySubnet**
60+
- Resource group named **myResourceGroup**
61+
62+
```azureppowershell-interactive
63+
64+
$rsg = "myResourceGroup"
65+
$loc = "East US 2"
66+
$vms = "myVMSS"
67+
$vnt = "myVnet"
68+
$sub = "mySubnet"
69+
$pol = "Automatic"
70+
$lbn = "myLoadBalancer"
71+
72+
$lb = Get-AzLoadBalancer -ResourceGroupName $rsg -Name $lbn
73+
74+
New-AzVmss -ResourceGroupName $rsg -Location $loc -VMScaleSetName $vms -VirtualNetworkName $vnt -SubnetName $sub -LoadBalancerName $lb -UpgradePolicyMode $pol
75+
```
76+
> [!NOTE]
77+
> After the scale set has been created, the backend port cannot be modified for a load balancing rule used by a health probe of the load balancer. To change the port, you can remove the health probe by updating the Azure virtual machine scale set, update the port and then configure the health probe again.
78+
79+
## Next steps
80+
81+
In this article, you deployed a virtual machine scale set with an existing Azure Load Balancer. To learn more about virtual machine scale sets and load balancer, see:
82+
83+
- [What is Azure Load Balancer?](load-balancer-overview.md)
84+
- [What are virtual machine scale sets?](../virtual-machine-scale-sets/overview.md)
85+

0 commit comments

Comments
 (0)