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-machine-scale-sets/tutorial-install-apps-cli.md
+25-17Lines changed: 25 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -85,26 +85,25 @@ az vmss extension set \
85
85
--settings customConfig.json
86
86
```
87
87
88
-
Each VM instance in the scale set downloads and runs the script from GitHub. In a more complex example, multiple application components and files could be installed. If the scale set is scaled up, the new VM instances automatically apply the same Custom Script Extension definition and install the required application.
89
-
90
88
> [!CAUTION]
91
89
> File names are case sensitive. Use the exact file name stated in these instructions to avoid failure.
92
90
93
-
## Test your scale set
94
-
To allow traffic to reach the web server, create a load balancer rule with [az network lb rule create](/cli/azure/network/lb/rule). The following example creates a rule named *myLoadBalancerRuleWeb*:
91
+
## Apply the extension to the existing scale set instances
92
+
Upgrade all the instances to apply the custom script. The upgrade may take a couple of minutes.
95
93
96
94
```azurecli-interactive
97
-
az network lb rule create \
98
-
--resource-group myResourceGroup \
99
-
--name myLoadBalancerRuleWeb \
100
-
--lb-name myScaleSetLB \
101
-
--backend-pool-name myScaleSetLBBEPool \
102
-
--backend-port 80 \
103
-
--frontend-ip-name loadBalancerFrontEnd \
104
-
--frontend-port 80 \
105
-
--protocol tcp
95
+
az vmss update-instances --resource-group myResourceGroup --name myScaleSet --instance-ids "*"
96
+
```
97
+
98
+
## Allow traffic to port 80
99
+
To allow traffic to flow through the load balancer to the virtual machines the default network security group needs to be updated.
To see your web server in action, obtain the public IP address of your load balancer with [az network public-ip show](/cli/azure/network/public-ip). The following example obtains the IP address for *myScaleSetLBPublicIP* created as part of the scale set:
109
108
110
109
```azurecli-interactive
@@ -121,9 +120,18 @@ Enter the public IP address of the load balancer in to a web browser. The load b
121
120
122
121
Leave the web browser open so that you can see an updated version in the next step.
123
122
124
-
## Update app deployment
125
-
Throughout the lifecycle of a scale set, you might need to deploy an updated version of your application. With the Custom Script Extension, you can reference an updated deploy script and then reapply the extension to your scale set. When the scale set was created in a previous step, the `--upgrade-policy-mode` was set to *automatic*. This setting allows the VM instances in the scale set to automatically update and apply the latest version of your application.
123
+
## Change the upgrade policy
124
+
In the previous section, in order to apply the updated application to all the scale set instances, a manual upgrade was needed. To enable updates to be applied automatically to all existing scale set instances, update the upgradepolicy from manual to automatic. For more information on upgrade policies, see [Upgrade policies for Virtual Machine Scale Sets](virtual-machine-scale-sets-upgrade-policy.md).
126
125
126
+
```azurecli-interactive
127
+
az vmss update \
128
+
--name myScaleSet \
129
+
--resource-group myResourceGroup \
130
+
--set upgradePolicy.mode=automatic
131
+
```
132
+
133
+
134
+
## Update app deployment
127
135
In your current shell, create a file named *customConfigv2.json* and paste the following configuration. This definition runs an updated *v2* version of the application install script:
128
136
129
137
```json
@@ -133,7 +141,7 @@ In your current shell, create a file named *customConfigv2.json* and paste the f
133
141
}
134
142
```
135
143
136
-
Apply the Custom Script Extension configuration to the VM instances in your scale set again with [az vmss extension set](/cli/azure/vmss/extension). The *customConfigv2.json* is used to apply the updated version of the application:
144
+
Apply the Custom Script Extension configuration to the your scale set again with [az vmss extension set](/cli/azure/vmss/extension). The *customConfigv2.json* is used to apply the updated version of the application:
137
145
138
146
```azurecli-interactive
139
147
az vmss extension set \
@@ -145,7 +153,7 @@ az vmss extension set \
145
153
--settings @customConfigv2.json
146
154
```
147
155
148
-
All VM instances in the scale set are automatically updated with the latest version of the sample web page. To see the updated version, refresh the web site in your browser:
156
+
Because the scale set is now using an automatic upgrade policy, the updated application will automatically be applied to existing scale set instances. Refresh your web browser to see the updated application.
149
157
150
158

Copy file name to clipboardExpand all lines: articles/virtual-machine-scale-sets/tutorial-install-apps-powershell.md
+34-5Lines changed: 34 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,6 +31,13 @@ The Custom Script extension integrates with Azure Resource Manager templates. It
31
31
To see the Custom Script Extension in action, create a scale set that installs the IIS web server and outputs the hostname of the scale set VM instance. The Custom Script Extension definition downloads a sample script from GitHub, installs the required packages, then writes the VM instance hostname to a basic HTML page.
32
32
33
33
## Create a scale set
34
+
35
+
Create a resource group with [New-AzResourceGroup](/powershell/module/az.compute/new-azresourcegroup). The following example creates a resource group named *myResourceGroup* in the *East US* location:
Now create a Virtual Machine Scale Set with [New-AzVmss](/powershell/module/az.compute/new-azvmss). To distribute traffic to the individual VM instances, a load balancer is also created. The load balancer includes rules to distribute traffic on TCP port 80. It also allows remote desktop traffic on TCP port 3389 and PowerShell remoting on TCP port 5985. When prompted, you can set your own administrative credentials for the VM instances in the scale set:
35
42
36
43
```azurepowershell-interactive
@@ -39,6 +46,7 @@ New-AzVmss `
39
46
-VMScaleSetName "myScaleSet" `
40
47
-OrchestrationMode "Flexible" `
41
48
-Location "EastUS" `
49
+
-UpgradePolicyMode "Manual" `
42
50
-VirtualNetworkName "myVnet" `
43
51
-SubnetName "mySubnet" `
44
52
-PublicIpAddressName "myPublicIPAddress" `
@@ -57,7 +65,7 @@ $customConfig = @{
57
65
}
58
66
```
59
67
60
-
Now, apply the Custom Script Extension with [Add-AzVmssExtension](/powershell/module/az.Compute/Add-azVmssExtension). The configuration object previously defined is passed to the extension. Update and run the extension on the VM instances with [Update-AzVmss](/powershell/module/az.compute/update-azvmss).
68
+
Now, apply the Custom Script Extension with [Add-AzVmssExtension](/powershell/module/az.Compute/Add-azVmssExtension). The configuration object previously defined is passed to the extension. Update the extension on the scale set profile instances with [Update-AzVmss](/powershell/module/az.compute/update-azvmss).
61
69
62
70
```azurepowershell-interactive
63
71
# Get information about the scale set
@@ -74,11 +82,19 @@ $vmss = Add-AzVmssExtension `
74
82
-TypeHandlerVersion 1.9 `
75
83
-Setting $customConfig
76
84
77
-
# Update the scale set and apply the Custom Script Extension to the VM instances
85
+
# Update the scale set
78
86
Update-AzVmss `
79
87
-ResourceGroupName "myResourceGroup" `
80
88
-Name "myScaleSet" `
81
89
-VirtualMachineScaleSet $vmss
90
+
91
+
```
92
+
93
+
## Add the extension to the existing scale set instances
94
+
Perform a manual upgrade to apply the updated extension to all the existing scale set instances. The update may take a couple of minutes to complete.
Each VM instance in the scale set downloads and runs the script from GitHub. In a more complex example, multiple application components and files could be installed. If the scale set is scaled up, the new VM instances automatically apply the same Custom Script Extension definition and install the required application.
@@ -134,8 +150,21 @@ Enter the public IP address of the load balancer in to a web browser. The load b
134
150
135
151
Leave the web browser open so that you can see an updated version in the next step.
136
152
153
+
## Change the upgrade policy
154
+
In the previous section, in order to apply the updated application to all the scale set instances, a manual upgrade was needed. To enable updates to be applied automatically to all existing scale set instances, update the upgrade policy from manual to automatic. For more information on upgrade policies, see [Upgrade policies for Virtual Machine Scale Sets](virtual-machine-scale-sets-upgrade-policy.md).
Throughout the lifecycle of a scale set, you may need to deploy an updated version of your application. With the Custom Script Extension, you can reference an updated deploy script and then reapply the extension to your scale set. When the scale set was created in a previous step, the `-UpgradePolicyMode` was set to *Automatic*. This setting allows the VM instances in the scale set to automatically update and apply the latest version of your application.
167
+
Throughout the lifecycle of a scale set, you may need to deploy an updated version of your application. With the Custom Script Extension, you can reference an updated deploy script and then reapply the extension to your scale set.
139
168
140
169
Create a new config definition named *customConfigv2*. This definition runs an updated *v2* version of the application install script:
141
170
@@ -146,7 +175,7 @@ $customConfigv2 = @{
146
175
}
147
176
```
148
177
149
-
Update the Custom Script Extension configuration to the VM instances in your scale set. The *customConfigv2* definition is used to apply the updated version of the application:
178
+
Update the Custom Script Extension configuration to the VM instances in your scale set. The *customConfigv2* definition is used to apply the updated version of the application to the scale set:
150
179
151
180
```azurepowershell-interactive
152
181
$vmss = Get-AzVmss `
@@ -161,7 +190,7 @@ Update-AzVmss `
161
190
-VirtualMachineScaleSet $vmss
162
191
```
163
192
164
-
All VM instances in the scale set are automatically updated with the latest version of the sample web page. To see the updated version, refresh the web site in your browser:
193
+
Because the scale set is now using an automatic upgrade policy, the updated application will automatically be applied to existing scale set instances. Refresh your web browser to see the updated application. To see the updated version, refresh the web site in your browser:
165
194
166
195

0 commit comments