|
1 |
| ---- |
2 |
| -title: Instance Protection for Azure virtual machine scale set instances |
3 |
| -description: Learn how to protect Azure virtual machine scale set instances from scale-in and scale-set operations. |
4 |
| -author: avirishuv |
5 |
| -ms.author: avverma |
6 |
| -ms.topic: conceptual |
7 |
| -ms.service: virtual-machine-scale-sets |
8 |
| -ms.subservice: instance-protection |
9 |
| -ms.date: 02/26/2020 |
10 |
| -ms.reviewer: jushiman |
11 |
| -ms.custom: avverma, devx-track-azurepowershell |
12 |
| - |
13 |
| ---- |
14 |
| -# Instance Protection for Azure virtual machine scale set instances |
15 |
| -**Applies to:** :heavy_check_mark: Linux VMs :heavy_check_mark: Windows VMs :heavy_check_mark: Flexible scale sets :heavy_check_mark: Uniform scale sets |
16 |
| - |
17 |
| -Azure virtual machine scale sets enable better elasticity for your workloads through [Autoscale](virtual-machine-scale-sets-autoscale-overview.md), so you can configure when your infrastructure scales-out and when it scales-in. Scale sets also enable you to centrally manage, configure, and update a large number of VMs through different [upgrade policy](virtual-machine-scale-sets-upgrade-scale-set.md#how-to-bring-vms-up-to-date-with-the-latest-scale-set-model) settings. You can configure an update on the scale set model and the new configuration is applied automatically to every scale set instance if you've set the upgrade policy to Automatic or Rolling. |
18 |
| - |
19 |
| -As your application processes traffic, there can be situations where you want specific instances to be treated differently from the rest of the scale set instance. For example, certain instances in the scale set could be performing long-running operations, and you don't want these instances to be scaled-in until the operations complete. You might also have specialized a few instances in the scale set to perform additional or different tasks than the other members of the scale set. You require these 'special' VMs not to be modified with the other instances in the scale set. Instance protection provides the additional controls to enable these and other scenarios for your application. |
20 |
| - |
21 |
| -This article describes how you can apply and use the different instance protection capabilities with scale set instances. |
22 |
| - |
23 |
| -## Types of instance protection |
24 |
| -Scale sets provide two types of instance protection capabilities: |
25 |
| - |
26 |
| -- **Protect from scale-in** |
27 |
| - - Enabled through **protectFromScaleIn** property on the scale set instance |
28 |
| - - Protects instance from Autoscale initiated scale-in |
29 |
| - - User-initiated instance operations (including instance delete) are **not blocked** |
30 |
| - - Operations initiated on the scale set (upgrade, reimage, deallocate, etc.) are **not blocked** |
31 |
| - |
32 |
| -- **Protect from scale set actions** |
33 |
| - - Enabled through **protectFromScaleSetActions** property on the scale set instance |
34 |
| - - Protects instance from Autoscale initiated scale-in |
35 |
| - - Protects instance from operations initiated on the scale set (such as upgrade, reimage, deallocate, etc.) |
36 |
| - - User-initiated instance operations (including instance delete) are **not blocked** |
37 |
| - - Delete of the full scale set is **not blocked** |
38 |
| - |
39 |
| -## Protect from scale-in |
40 |
| -Instance protection can be applied to scale set instances after the instances are created. Protection is applied and modified only on the [instance model](virtual-machine-scale-sets-upgrade-scale-set.md#the-scale-set-vm-model-view) and not on the [scale set model](virtual-machine-scale-sets-upgrade-scale-set.md#the-scale-set-model). |
41 |
| - |
42 |
| -There are multiple ways of applying scale-in protection on your scale set instances as detailed in the examples below. |
43 |
| - |
44 |
| -### Azure portal |
45 |
| - |
46 |
| -You can apply scale-in protection through the Azure portal to an instance in the scale set. You cannot adjust more than one instance at a time. Repeat the steps for each instance you want to protect. |
47 |
| - |
48 |
| -1. Go to an existing virtual machine scale set. |
49 |
| -1. Select **Instances** from the menu on the left, under **Settings**. |
50 |
| -1. Select the name of the instance you want to protect. |
51 |
| -1. Select the **Protection Policy** tab. |
52 |
| -1. In the **Protection Policy** blade, select the **Protect from scale-in** option. |
53 |
| -1. Select **Save**. |
54 |
| - |
55 |
| -### REST API |
56 |
| - |
57 |
| -The following example applies scale-in protection to an instance in the scale set. |
58 |
| - |
59 |
| -``` |
60 |
| -PUT on `/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instance-id}?api-version=2019-03-01` |
61 |
| -``` |
62 |
| - |
63 |
| -```json |
64 |
| -{ |
65 |
| - "properties": { |
66 |
| - "protectionPolicy": { |
67 |
| - "protectFromScaleIn": true |
68 |
| - } |
69 |
| - } |
70 |
| -} |
71 |
| - |
72 |
| -``` |
73 |
| - |
74 |
| -> [!NOTE] |
75 |
| ->Instance protection is only supported with API version 2019-03-01 and above |
76 |
| -
|
77 |
| -### Azure PowerShell |
78 |
| - |
79 |
| -Use the [Update-AzVmssVM](/powershell/module/az.compute/update-azvmssvm) cmdlet to apply scale-in protection to your scale set instance. |
80 |
| - |
81 |
| -The following example applies scale-in protection to an instance in the scale set having instance ID 0. |
82 |
| - |
83 |
| -```azurepowershell-interactive |
84 |
| -Update-AzVmssVM ` |
85 |
| - -ResourceGroupName "myResourceGroup" ` |
86 |
| - -VMScaleSetName "myVMScaleSet" ` |
87 |
| - -InstanceId 0 ` |
88 |
| - -ProtectFromScaleIn $true |
89 |
| -``` |
90 |
| - |
91 |
| -### Azure CLI 2.0 |
92 |
| - |
93 |
| -Use [az vmss update](/cli/azure/vmss#az-vmss-update) to apply scale-in protection to your scale set instance. |
94 |
| - |
95 |
| -The following example applies scale-in protection to an instance in the scale set having instance ID 0. |
96 |
| - |
97 |
| -```azurecli-interactive |
98 |
| -az vmss update \ |
99 |
| - --resource-group <myResourceGroup> \ |
100 |
| - --name <myVMScaleSet> \ |
101 |
| - --instance-id 0 \ |
102 |
| - --protect-from-scale-in true |
103 |
| -``` |
104 |
| - |
105 |
| -## Protect from scale set actions |
106 |
| -Instance protection can be applied to scale set instances after the instances are created. Protection is applied and modified only on the [instance model](virtual-machine-scale-sets-upgrade-scale-set.md#the-scale-set-vm-model-view) and not on the [scale set model](virtual-machine-scale-sets-upgrade-scale-set.md#the-scale-set-model). |
107 |
| - |
108 |
| -Protecting an instance from scale set actions also protects the instance from Autoscale initiated scale-in. |
109 |
| - |
110 |
| -There are multiple ways of applying scale set actions protection on your scale set instances as detailed in the examples below. |
111 |
| - |
112 |
| -### Azure portal |
113 |
| - |
114 |
| -You can apply protection from scale set actions through the Azure portal to an instance in the scale set. You cannot adjust more than one instance at a time. Repeat the steps for each instance you want to protect. |
115 |
| - |
116 |
| -1. Go to an existing virtual machine scale set. |
117 |
| -1. Select **Instances** from the menu on the left, under **Settings**. |
118 |
| -1. Select the name of the instance you want to protect. |
119 |
| -1. Select the **Protection Policy** tab. |
120 |
| -1. In the **Protection Policy** blade, select the **Protect from scale set actions** option. |
121 |
| -1. Select **Save**. |
122 |
| - |
123 |
| -### REST API |
124 |
| - |
125 |
| -The following example applies protection from scale set actions to an instance in the scale set. |
126 |
| - |
127 |
| -``` |
128 |
| -PUT on `/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vMScaleSetName}/virtualMachines/{instance-id}?api-version=2019-03-01` |
129 |
| -``` |
130 |
| - |
131 |
| -```json |
132 |
| -{ |
133 |
| - "properties": { |
134 |
| - "protectionPolicy": { |
135 |
| - "protectFromScaleIn": true, |
136 |
| - "protectFromScaleSetActions": true |
137 |
| - } |
138 |
| - } |
139 |
| -} |
140 |
| - |
141 |
| -``` |
142 |
| - |
143 |
| -> [!NOTE] |
144 |
| ->Instance protection is only supported with API version 2019-03-01 and above.</br> |
145 |
| -Protecting an instance from scale set actions also protects the instance from Autoscale initiated scale-in. You can't specify "protectFromScaleIn": false when setting "protectFromScaleSetActions": true |
146 |
| - |
147 |
| -### Azure PowerShell |
148 |
| - |
149 |
| -Use the [Update-AzVmssVM](/powershell/module/az.compute/update-azvmssvm) cmdlet to apply protection from scale set actions to your scale set instance. |
150 |
| - |
151 |
| -The following example applies protection from scale set actions to an instance in the scale set having instance ID 0. |
152 |
| - |
153 |
| -```azurepowershell-interactive |
154 |
| -Update-AzVmssVM ` |
155 |
| - -ResourceGroupName "myResourceGroup" ` |
156 |
| - -VMScaleSetName "myVMScaleSet" ` |
157 |
| - -InstanceId 0 ` |
158 |
| - -ProtectFromScaleIn $true ` |
159 |
| - -ProtectFromScaleSetAction $true |
160 |
| -``` |
161 |
| - |
162 |
| -### Azure CLI 2.0 |
163 |
| - |
164 |
| -Use [az vmss update](/cli/azure/vmss#az-vmss-update) to apply protection from scale set actions to your scale set instance. |
165 |
| - |
166 |
| -The following example applies protection from scale set actions to an instance in the scale set having instance ID 0. |
167 |
| - |
168 |
| -```azurecli-interactive |
169 |
| -az vmss update \ |
170 |
| - --resource-group <myResourceGroup> \ |
171 |
| - --name <myVMScaleSet> \ |
172 |
| - --instance-id 0 \ |
173 |
| - --protect-from-scale-in true \ |
174 |
| - --protect-from-scale-set-actions true |
175 |
| -``` |
176 |
| - |
177 |
| -## Troubleshoot |
178 |
| -### No protectionPolicy on scale set model |
179 |
| -Instance protection is only applicable on scale set instances and not on the scale set model. |
180 |
| - |
181 |
| -### No protectionPolicy on scale set instance model |
182 |
| -By default, protection policy is not applied to an instance when it is created. |
183 |
| - |
184 |
| -You can apply instance protection to scale set instances after the instances are created. |
185 |
| - |
186 |
| -### Not able to apply instance protection |
187 |
| -Instance protection is only supported with API version 2019-03-01 and above. Check the API version being used and update as required. You might also need to update your PowerShell or CLI to the latest version. |
188 |
| - |
189 |
| -## Next steps |
190 |
| -Learn how to [deploy your application](virtual-machine-scale-sets-deploy-app.md) on virtual machine scale sets. |
| 1 | +--- |
| 2 | +title: Instance Protection for Azure virtual machine scale set instances |
| 3 | +description: Learn how to protect Azure virtual machine scale set instances from scale-in and scale-set operations. |
| 4 | +author: avirishuv |
| 5 | +ms.author: avverma |
| 6 | +ms.topic: conceptual |
| 7 | +ms.service: virtual-machine-scale-sets |
| 8 | +ms.subservice: instance-protection |
| 9 | +ms.date: 02/26/2020 |
| 10 | +ms.reviewer: jushiman |
| 11 | +ms.custom: avverma, devx-track-azurepowershell |
| 12 | + |
| 13 | +--- |
| 14 | +# Instance Protection for Azure virtual machine scale set instances |
| 15 | +**Applies to:** :heavy_check_mark: Uniform scale sets |
| 16 | + |
| 17 | +Azure virtual machine scale sets enable better elasticity for your workloads through [Autoscale](virtual-machine-scale-sets-autoscale-overview.md), so you can configure when your infrastructure scales-out and when it scales-in. Scale sets also enable you to centrally manage, configure, and update a large number of VMs through different [upgrade policy](virtual-machine-scale-sets-upgrade-scale-set.md#how-to-bring-vms-up-to-date-with-the-latest-scale-set-model) settings. You can configure an update on the scale set model and the new configuration is applied automatically to every scale set instance if you've set the upgrade policy to Automatic or Rolling. |
| 18 | + |
| 19 | +As your application processes traffic, there can be situations where you want specific instances to be treated differently from the rest of the scale set instance. For example, certain instances in the scale set could be performing long-running operations, and you don't want these instances to be scaled-in until the operations complete. You might also have specialized a few instances in the scale set to perform additional or different tasks than the other members of the scale set. You require these 'special' VMs not to be modified with the other instances in the scale set. Instance protection provides the additional controls to enable these and other scenarios for your application. |
| 20 | + |
| 21 | +This article describes how you can apply and use the different instance protection capabilities with scale set instances. |
| 22 | + |
| 23 | +## Types of instance protection |
| 24 | +Scale sets provide two types of instance protection capabilities: |
| 25 | + |
| 26 | +- **Protect from scale-in** |
| 27 | + - Enabled through **protectFromScaleIn** property on the scale set instance |
| 28 | + - Protects instance from Autoscale initiated scale-in |
| 29 | + - User-initiated instance operations (including instance delete) are **not blocked** |
| 30 | + - Operations initiated on the scale set (upgrade, reimage, deallocate, etc.) are **not blocked** |
| 31 | + |
| 32 | +- **Protect from scale set actions** |
| 33 | + - Enabled through **protectFromScaleSetActions** property on the scale set instance |
| 34 | + - Protects instance from Autoscale initiated scale-in |
| 35 | + - Protects instance from operations initiated on the scale set (such as upgrade, reimage, deallocate, etc.) |
| 36 | + - User-initiated instance operations (including instance delete) are **not blocked** |
| 37 | + - Delete of the full scale set is **not blocked** |
| 38 | + |
| 39 | +## Protect from scale-in |
| 40 | +Instance protection can be applied to scale set instances after the instances are created. Protection is applied and modified only on the [instance model](virtual-machine-scale-sets-upgrade-scale-set.md#the-scale-set-vm-model-view) and not on the [scale set model](virtual-machine-scale-sets-upgrade-scale-set.md#the-scale-set-model). |
| 41 | + |
| 42 | +There are multiple ways of applying scale-in protection on your scale set instances as detailed in the examples below. |
| 43 | + |
| 44 | +### Azure portal |
| 45 | + |
| 46 | +You can apply scale-in protection through the Azure portal to an instance in the scale set. You cannot adjust more than one instance at a time. Repeat the steps for each instance you want to protect. |
| 47 | + |
| 48 | +1. Go to an existing virtual machine scale set. |
| 49 | +1. Select **Instances** from the menu on the left, under **Settings**. |
| 50 | +1. Select the name of the instance you want to protect. |
| 51 | +1. Select the **Protection Policy** tab. |
| 52 | +1. In the **Protection Policy** blade, select the **Protect from scale-in** option. |
| 53 | +1. Select **Save**. |
| 54 | + |
| 55 | +### REST API |
| 56 | + |
| 57 | +The following example applies scale-in protection to an instance in the scale set. |
| 58 | + |
| 59 | +``` |
| 60 | +PUT on `/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instance-id}?api-version=2019-03-01` |
| 61 | +``` |
| 62 | + |
| 63 | +```json |
| 64 | +{ |
| 65 | + "properties": { |
| 66 | + "protectionPolicy": { |
| 67 | + "protectFromScaleIn": true |
| 68 | + } |
| 69 | + } |
| 70 | +} |
| 71 | + |
| 72 | +``` |
| 73 | + |
| 74 | +> [!NOTE] |
| 75 | +>Instance protection is only supported with API version 2019-03-01 and above |
| 76 | +
|
| 77 | +### Azure PowerShell |
| 78 | + |
| 79 | +Use the [Update-AzVmssVM](/powershell/module/az.compute/update-azvmssvm) cmdlet to apply scale-in protection to your scale set instance. |
| 80 | + |
| 81 | +The following example applies scale-in protection to an instance in the scale set having instance ID 0. |
| 82 | + |
| 83 | +```azurepowershell-interactive |
| 84 | +Update-AzVmssVM ` |
| 85 | + -ResourceGroupName "myResourceGroup" ` |
| 86 | + -VMScaleSetName "myVMScaleSet" ` |
| 87 | + -InstanceId 0 ` |
| 88 | + -ProtectFromScaleIn $true |
| 89 | +``` |
| 90 | + |
| 91 | +### Azure CLI 2.0 |
| 92 | + |
| 93 | +Use [az vmss update](/cli/azure/vmss#az-vmss-update) to apply scale-in protection to your scale set instance. |
| 94 | + |
| 95 | +The following example applies scale-in protection to an instance in the scale set having instance ID 0. |
| 96 | + |
| 97 | +```azurecli-interactive |
| 98 | +az vmss update \ |
| 99 | + --resource-group <myResourceGroup> \ |
| 100 | + --name <myVMScaleSet> \ |
| 101 | + --instance-id 0 \ |
| 102 | + --protect-from-scale-in true |
| 103 | +``` |
| 104 | + |
| 105 | +## Protect from scale set actions |
| 106 | +Instance protection can be applied to scale set instances after the instances are created. Protection is applied and modified only on the [instance model](virtual-machine-scale-sets-upgrade-scale-set.md#the-scale-set-vm-model-view) and not on the [scale set model](virtual-machine-scale-sets-upgrade-scale-set.md#the-scale-set-model). |
| 107 | + |
| 108 | +Protecting an instance from scale set actions also protects the instance from Autoscale initiated scale-in. |
| 109 | + |
| 110 | +There are multiple ways of applying scale set actions protection on your scale set instances as detailed in the examples below. |
| 111 | + |
| 112 | +### Azure portal |
| 113 | + |
| 114 | +You can apply protection from scale set actions through the Azure portal to an instance in the scale set. You cannot adjust more than one instance at a time. Repeat the steps for each instance you want to protect. |
| 115 | + |
| 116 | +1. Go to an existing virtual machine scale set. |
| 117 | +1. Select **Instances** from the menu on the left, under **Settings**. |
| 118 | +1. Select the name of the instance you want to protect. |
| 119 | +1. Select the **Protection Policy** tab. |
| 120 | +1. In the **Protection Policy** blade, select the **Protect from scale set actions** option. |
| 121 | +1. Select **Save**. |
| 122 | + |
| 123 | +### REST API |
| 124 | + |
| 125 | +The following example applies protection from scale set actions to an instance in the scale set. |
| 126 | + |
| 127 | +``` |
| 128 | +PUT on `/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vMScaleSetName}/virtualMachines/{instance-id}?api-version=2019-03-01` |
| 129 | +``` |
| 130 | + |
| 131 | +```json |
| 132 | +{ |
| 133 | + "properties": { |
| 134 | + "protectionPolicy": { |
| 135 | + "protectFromScaleIn": true, |
| 136 | + "protectFromScaleSetActions": true |
| 137 | + } |
| 138 | + } |
| 139 | +} |
| 140 | + |
| 141 | +``` |
| 142 | + |
| 143 | +> [!NOTE] |
| 144 | +>Instance protection is only supported with API version 2019-03-01 and above.</br> |
| 145 | +Protecting an instance from scale set actions also protects the instance from Autoscale initiated scale-in. You can't specify "protectFromScaleIn": false when setting "protectFromScaleSetActions": true |
| 146 | + |
| 147 | +### Azure PowerShell |
| 148 | + |
| 149 | +Use the [Update-AzVmssVM](/powershell/module/az.compute/update-azvmssvm) cmdlet to apply protection from scale set actions to your scale set instance. |
| 150 | + |
| 151 | +The following example applies protection from scale set actions to an instance in the scale set having instance ID 0. |
| 152 | + |
| 153 | +```azurepowershell-interactive |
| 154 | +Update-AzVmssVM ` |
| 155 | + -ResourceGroupName "myResourceGroup" ` |
| 156 | + -VMScaleSetName "myVMScaleSet" ` |
| 157 | + -InstanceId 0 ` |
| 158 | + -ProtectFromScaleIn $true ` |
| 159 | + -ProtectFromScaleSetAction $true |
| 160 | +``` |
| 161 | + |
| 162 | +### Azure CLI 2.0 |
| 163 | + |
| 164 | +Use [az vmss update](/cli/azure/vmss#az-vmss-update) to apply protection from scale set actions to your scale set instance. |
| 165 | + |
| 166 | +The following example applies protection from scale set actions to an instance in the scale set having instance ID 0. |
| 167 | + |
| 168 | +```azurecli-interactive |
| 169 | +az vmss update \ |
| 170 | + --resource-group <myResourceGroup> \ |
| 171 | + --name <myVMScaleSet> \ |
| 172 | + --instance-id 0 \ |
| 173 | + --protect-from-scale-in true \ |
| 174 | + --protect-from-scale-set-actions true |
| 175 | +``` |
| 176 | + |
| 177 | +## Troubleshoot |
| 178 | +### No protectionPolicy on scale set model |
| 179 | +Instance protection is only applicable on scale set instances and not on the scale set model. |
| 180 | + |
| 181 | +### No protectionPolicy on scale set instance model |
| 182 | +By default, protection policy is not applied to an instance when it is created. |
| 183 | + |
| 184 | +You can apply instance protection to scale set instances after the instances are created. |
| 185 | + |
| 186 | +### Not able to apply instance protection |
| 187 | +Instance protection is only supported with API version 2019-03-01 and above. Check the API version being used and update as required. You might also need to update your PowerShell or CLI to the latest version. |
| 188 | + |
| 189 | +## Next steps |
| 190 | +Learn how to [deploy your application](virtual-machine-scale-sets-deploy-app.md) on virtual machine scale sets. |
0 commit comments