Skip to content

Commit b409b9f

Browse files
authored
Merge pull request #221771 from mimckitt/final-updates-before-merge
Final Updates before Merging
2 parents d68fb6a + 370d31a commit b409b9f

14 files changed

+89
-211
lines changed

articles/virtual-machine-scale-sets/tutorial-autoscale-cli.md

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@ ms.author: jushiman
66
ms.topic: tutorial
77
ms.service: virtual-machine-scale-sets
88
ms.subservice: autoscale
9-
ms.date: 11/22/2022
9+
ms.date: 12/16/2022
1010
ms.reviewer: mimckitt
1111
ms.custom: avverma, devx-track-azurecli
1212

1313
---
1414
# Tutorial: Automatically scale a Virtual Machine Scale Set with the Azure CLI
15-
1615
When you create a scale set, you define the number of VM instances that you wish to run. As your application demand changes, you can automatically increase or decrease the number of VM instances. The ability to autoscale lets you keep up with customer demand or respond to application performance changes throughout the lifecycle of your app. In this tutorial you learn how to:
1716

1817
> [!div class="checklist"]
@@ -28,14 +27,13 @@ When you create a scale set, you define the number of VM instances that you wish
2827
- This tutorial requires version 2.0.32 or later of the Azure CLI. If using Azure Cloud Shell, the latest version is already installed.
2928

3029
## Create a scale set
31-
32-
Create a resource group with [az group create](/cli/azure/group) as follows:
30+
Create a resource group with [az group create](/cli/azure/group).
3331

3432
```azurecli-interactive
3533
az group create --name myResourceGroup --location eastus
3634
```
3735

38-
Now create a Virtual Machine Scale Set with [az vmss create](/cli/azure/vmss). The following example creates a scale set with an instance count of *2*, and generates SSH keys if they don't exist:
36+
Now create a Virtual Machine Scale Set with [az vmss create](/cli/azure/vmss). The following example creates a scale set with an instance count of *2*, and generates SSH keys if they don't exist.
3937

4038
```azurecli-interactive
4139
az vmss create \
@@ -49,7 +47,6 @@ az vmss create \
4947
```
5048

5149
## Define an autoscale profile
52-
5350
To enable autoscale on a scale set, you first define an autoscale profile. This profile defines the default, minimum, and maximum scale set capacity. These limits let you control cost by not continually creating VM instances, and balance acceptable performance with a minimum number of instances that remain in a scale-in event. Create an autoscale profile with [az monitor autoscale create](/cli/azure/monitor/autoscale#az-monitor-autoscale-create). The following example sets the default, and minimum, capacity of *2* VM instances, and a maximum of *10*:
5451

5552
```azurecli-interactive
@@ -64,7 +61,6 @@ az monitor autoscale create \
6461
```
6562

6663
## Create a rule to autoscale out
67-
6864
If your application demand increases, the load on the VM instances in your scale set increases. If this increased load is consistent, rather than just a brief demand, you can configure autoscale rules to increase the number of VM instances in the scale set. When these VM instances are created and your applications are deployed, the scale set starts to distribute traffic to them through the load balancer. You control what metrics to monitor, how long the application load must meet a given threshold, and how many VM instances to add to the scale set.
6965

7066
Create a rule with [az monitor autoscale rule create](/cli/azure/monitor/autoscale/rule#az-monitor-autoscale-rule-create) that increases the number of VM instances in a scale set when the average CPU load is greater than 70% over a 5-minute period. When the rule triggers, the number of VM instances is increased by three.
@@ -78,10 +74,9 @@ az monitor autoscale rule create \
7874
```
7975

8076
## Create a rule to autoscale in
81-
8277
On an evening or weekend, your application demand may decrease. If this decreased load is consistent over a period of time, you can configure autoscale rules to decrease the number of VM instances in the scale set. This scale-in action reduces the cost to run your scale set as you only run the number of instances required to meet the current demand.
8378

84-
Create another rule with [az monitor autoscale rule create](/cli/azure/monitor/autoscale/rule#az-monitor-autoscale-rule-create) that decreases the number of VM instances in a scale set when the average CPU load then drops below 30% over a 5-minute period. The following example defines the rule to scale in the number of VM instances by one:
79+
Create another rule with [az monitor autoscale rule create](/cli/azure/monitor/autoscale/rule#az-monitor-autoscale-rule-create) that decreases the number of VM instances in a scale set when the average CPU load then drops below 30% over a 5-minute period. The following example defines the rule to scale in the number of VM instances by one.
8580

8681
```azurecli-interactive
8782
az monitor autoscale rule create \
@@ -92,7 +87,6 @@ az monitor autoscale rule create \
9287
```
9388

9489
## Generate CPU load on scale set
95-
9690
To test the autoscale rules, generate some CPU load on the VM instances in the scale set. This simulated CPU load causes the autoscales to scale out and increase the number of VM instances. As the simulated CPU load is then decreased, the autoscale rules scale in and reduce the number of VM instances.
9791

9892
To connect to an individual instance, see [Tutorial: Connect to Virtual Machine Scale Set instances](tutorial-connect-to-instances-cli.md)
@@ -142,7 +136,6 @@ exit
142136
```
143137

144138
## Monitor the active autoscale rules
145-
146139
To monitor the number of VM instances in your scale set, use **watch**. It takes 5 minutes for the autoscale rules to begin the scale-out process in response to the CPU load generated by **stress** on each of the VM instances:
147140

148141
```azurecli-interactive
@@ -169,21 +162,19 @@ Every 2.0s: az vmss list-instances --resource-group myResourceGroup --name mySca
169162
Once **stress** stops on the initial VM instances, the average CPU load returns to normal. After another 5 minutes, the autoscale rules then scale in the number of VM instances. Scale in actions remove VM instances with the highest IDs first. When a scale set uses Availability Sets or Availability Zones, scale in actions are evenly distributed across those VM instances. The following example output shows one VM instance deleted as the scale set autoscales in:
170163

171164
```output
172-
6 True eastus myScaleSet_6 Deleting myResourceGroup 9e4133dd-2c57-490e-ae45-90513ce3b336
165+
6 True eastus myScaleSet_6 Deleting myResourceGroup 9e4133dd-2c57-490e-ae45-90513ce3b336
173166
```
174167

175168
Exit *watch* with `Ctrl-c`. The scale set continues to scale in every 5 minutes and remove one VM instance until the minimum instance count of two is reached.
176169

177170
## Clean up resources
178-
179171
To remove your scale set and additional resources, delete the resource group and all its resources with [az group delete](/cli/azure/group). The `--no-wait` parameter returns control to the prompt without waiting for the operation to complete. The `--yes` parameter confirms that you wish to delete the resources without an additional prompt to do so.
180172

181173
```azurecli-interactive
182174
az group delete --name myResourceGroup --yes --no-wait
183175
```
184176

185177
## Next steps
186-
187178
In this tutorial, you learned how to automatically scale in or out a scale set with the Azure CLI:
188179

189180
> [!div class="checklist"]

articles/virtual-machine-scale-sets/tutorial-autoscale-powershell.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ ms.custom: avverma, devx-track-azurepowershell
1616
> [!NOTE]
1717
> This tutorial uses Uniform Orchestration mode. We recommend using Flexible Orchestration for new workloads. For more information, see [Orchestration modes for Virtual Machine Scale Sets in Azure](virtual-machine-scale-sets-orchestration-modes.md).
1818
19-
[!INCLUDE [requires-azurerm](../../includes/requires-azurerm.md)]
20-
2119
When you create a scale set, you define the number of VM instances that you wish to run. As your application demand changes, you can automatically increase or decrease the number of VM instances. The ability to autoscale lets you keep up with customer demand or respond to application performance changes throughout the lifecycle of your app. In this tutorial you learn how to:
2220

2321
> [!div class="checklist"]
@@ -244,7 +242,6 @@ To remove your scale set and additional resources, delete the resource group and
244242
Remove-AzureRmResourceGroup -Name "myResourceGroup" -Force -AsJob
245243
```
246244

247-
248245
## Next steps
249246
In this tutorial, you learned how to automatically scale in or out a scale set with Azure PowerShell:
250247

articles/virtual-machine-scale-sets/tutorial-connect-to-instances-cli.md

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,13 @@ author: ju-shim
55
ms.author: jushiman
66
ms.topic: tutorial
77
ms.service: virtual-machine-scale-sets
8-
ms.date: 11/29/2022
8+
ms.date: 12/16/2022
99
ms.reviewer: mimckitt
1010
ms.custom: mimckitt, devx-track-azurecli
1111

1212
---
1313

1414
# Tutorial: Connect to Virtual Machine Scale Set instances using the Azure CLI
15-
1615
A Virtual Machine Scale Set allows you to deploy and manage a set of virtual machines. Throughout the lifecycle of a Virtual Machine Scale Set, you may need to run one or more management tasks. In this tutorial you learn how to:
1716

1817
> [!div class="checklist"]
@@ -25,9 +24,7 @@ A Virtual Machine Scale Set allows you to deploy and manage a set of virtual mac
2524

2625
This article requires version 2.0.29 or later of the Azure CLI. If using Azure Cloud Shell, the latest version is already installed.
2726

28-
2927
## List instances in a scale set
30-
3128
If you do not have a scale set already created, see [Tutorial: Create and manage a Virtual Machine Scale Set with the Azure CLI](tutorial-create-and-manage-cli.md)
3229

3330
List all the instances in your Virtual Machine Scale Set.
@@ -46,10 +43,8 @@ eastus myScaleSet_0e7d4d21 myResourceGroup
4643
eastus myScaleSet_39379fc3 myResourceGroup
4744
```
4845

49-
5046
## Get NIC information
51-
52-
Using the VM name of the instance you want to connect to, use [az vm nic list](/cli/) to find the NIC name.
47+
Use [az vm nic list](/cli/azure/vm/nic#az-vm-nic-list) and the name of the individual VM instance to find the NIC name.
5348

5449
```azurecli-interactive
5550
az vm nic list \
@@ -68,7 +63,7 @@ az vm nic list \
6863
]
6964
```
7065

71-
Using the VM name and NIC name, get the private IP address of the NIC, the Inbound NAT rule name and load balancer name using [az vm nic show](/cli).
66+
Using the VM name and NIC name, get the private IP address of the NIC, the Inbound NAT rule name and load balancer name using [az vm nic show](/cli/azure/vm/nic#az-vm-nic-show).
7267

7368

7469
```azurecli-interactive
@@ -114,16 +109,14 @@ az vm nic show --resource-group myResourceGroup --vm-name myScaleSet_0e7d4d21 --
114109
"tapConfigurations": [],
115110
"type": "Microsoft.Network/networkInterfaces",
116111
"virtualMachine": {
117-
"id": "/subscriptions/resourceGroups/MYRESOURCEGROUP/providers/Microsoft.Compute/virtualMachines/myScaleSet_0e7d4d21",
118-
"resourceGroup": "MYRESOURCEGROUP"
112+
"id": "/subscriptions/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myScaleSet_0e7d4d21",
113+
"resourceGroup": "myResourceGroup"
119114
},
120115
}
121116
```
122117

123-
124118
## Get backend pool details
125-
Using the backend pool name and load balancer name, get the port for the private IP address of the instance you want to connect to.
126-
119+
Using the backend pool name and load balancer name, get the port for the private IP address of the instance you want to connect to with [az network lb list-mapping](/cli/azure/network/lb#az-network-lb-list-mapping).
127120

128121
```azurecli-interactive
129122
az network lb list-mapping --backend-pool-name myScaleSetLBBEPool --resource-group myResourceGroup --name myScaleSetLB --request ip=10.0.0.5
@@ -143,8 +136,7 @@ az network lb list-mapping --backend-pool-name myScaleSetLBBEPool --resource-gro
143136
```
144137

145138
## Get public IP of load balancer
146-
147-
Get the public IP of the load balancer
139+
Get the public IP of the load balancer using [az network public-ip list](/cli/azure/network/public-ip#az-network-public-ip-list).
148140

149141
```azurecli-interactive
150142
az network public-ip list --resource-group myResourceGroup

articles/virtual-machine-scale-sets/tutorial-connect-to-instances-powershell.md

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,13 @@ author: ju-shim
55
ms.author: jushiman
66
ms.topic: tutorial
77
ms.service: virtual-machine-scale-sets
8-
ms.date: 11/29/2022
8+
ms.date: 12/16/2022
99
ms.reviewer: mimckitt
1010
ms.custom: mimckitt, devx-track-azurepowershell
1111

1212
---
1313

1414
# Tutorial: Connect to Virtual Machine Scale Set instances using Azure PowerShell
15-
1615
A Virtual Machine Scale Set allows you to deploy and manage a set of virtual machines. Throughout the lifecycle of a Virtual Machine Scale Set, you may need to run one or more management tasks. In this tutorial you learn how to:
1716

1817
> [!div class="checklist"]
@@ -21,13 +20,9 @@ A Virtual Machine Scale Set allows you to deploy and manage a set of virtual mac
2120
2221
If you don't have an Azure subscription, create a [free account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F) before you begin.
2322

24-
[!INCLUDE [updated-for-az.md](../../includes/updated-for-az.md)]
25-
2623
[!INCLUDE [cloud-shell-try-it.md](../../includes/cloud-shell-try-it.md)]
2724

28-
2925
## List instances in a scale set
30-
3126
If you don't have a scale set already created, see [Tutorial: Create and manage a Virtual Machine Scale Set with Azure PowerShell](tutorial-create-and-manage-powershell.md).
3227

3328
List all the instances in your Virtual Machine Scale Set using [Get-AzVM](/powershell/module/az.compute/get-azvm).
@@ -43,11 +38,8 @@ myResourceGroup myScaleSet_Instance1 eastus Standard_DS1_v2 Windows
4338
myResourceGroup myScaleSet_Instance2 eastus Standard_DS1_v2 Windows myScaleSet-instance2-nic
4439
```
4540

46-
4741
## Get NIC information
48-
49-
50-
Using the NIC name, get the private IP address of the NIC, the backend address pool name and load balancer name using [Get-AzNetworkInterface](/powershell/module/az.network/get-aznetworkinterface).
42+
Using the NIC name, get the private IP address of the NIC, the backend address pool name and load balancer name with [Get-AzNetworkInterface](/powershell/module/az.network/get-aznetworkinterface).
5143

5244
```azurepowershell-interactive
5345
Get-AzNetworkInterface -Name myScaleSet-instance1-nic
@@ -97,10 +89,10 @@ Using the backend pool name, load balancer name and private IP address, get the
9789

9890
```azurepowershell-interactive
9991
Get-AzLoadBalancerBackendAddressInboundNatRulePortMapping `
100-
-ResourceGroupName myResourceGroup `
101-
-LoadBalancerName myScaleSet `
102-
-Name myScaleSet `
103-
-IpAddress 192.168.1.5
92+
-ResourceGroupName myResourceGroup `
93+
-LoadBalancerName myScaleSet `
94+
-Name myScaleSet `
95+
-IpAddress 192.168.1.5
10496
```
10597

10698
If you run the above command and find your load balancer doesn't have any inbound NAT rules, you can add inbound NAT rules using [Add-AzLoadBalancerInboundNatRuleConfig](/powershell/module/az.network/add-azloadbalancerinboundnatruleconfig). Once complete, run [Get-AzLoadBalancerBackendAddressInboundNatRulePortMapping](/powershell/module/az.network/add-azloadbalancerinboundnatruleconfig) again.
@@ -111,7 +103,6 @@ $slb | Add-AzLoadBalancerInboundNatRuleConfig -Name "myNatRule" -FrontendIPConfi
111103
$slb | Set-AzLoadBalancer
112104
```
113105

114-
115106
```output
116107
InboundNatRuleName : myNatRule
117108
Protocol : Tcp
@@ -120,7 +111,6 @@ BackendPort : 3389
120111
```
121112

122113
## Get public IP of load balancer
123-
124114
Get the public IP of the load balancer using [GetAzPublicIpAddress](/powershell/module/az.network/get-azpublicipaddress).
125115

126116
```azurepowershell-interactive
@@ -152,7 +142,6 @@ Sku : {
152142
```
153143

154144
## Connect to your instance
155-
156145
Remote Desktop to your machine using the Public IP address of the load balancer and the Port mapping to the machine instance you want to connect to.
157146

158147
:::image type="content" source="media/virtual-machine-scale-sets-connect-to-instances/tutorial-connect-to-instances-powershell-rdp.png" alt-text="Screenshot of remote desktop application from Windows machine.":::
@@ -167,4 +156,4 @@ In this tutorial, you learned how to list the instances in your scale set and co
167156
168157

169158
> [!div class="nextstepaction"]
170-
> [Modify a scale set](tutorial-modify-scale-sets-cli.md)
159+
> [Modify a scale set](tutorial-modify-scale-sets-powershell.md)

0 commit comments

Comments
 (0)