Skip to content

Commit 8432e58

Browse files
authored
Merge pull request #223792 from EdB-MSFT/autoscale-contiguous-profiles
Autoscale contiguous profiles
2 parents b1b6165 + 46e08f1 commit 8432e58

File tree

1 file changed

+21
-154
lines changed

1 file changed

+21
-154
lines changed

articles/azure-monitor/autoscale/autoscale-multiprofile.md

Lines changed: 21 additions & 154 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ms.author: edbaynash
66
ms.service: azure-monitor
77
ms.subservice: autoscale
88
ms.topic: conceptual
9-
ms.date: 09/30/2022
9+
ms.date: 01/10/2023
1010
ms.reviewer: akkumari
1111

1212

@@ -43,24 +43,28 @@ The example below shows an autoscale setting with a default profile and recurrin
4343

4444
In the above example, on Monday after 6 AM, the recurring profile will be used. If the instance count is less than 3, autoscale scales to the new minimum of three. Autoscale continues to use this profile and scales based on CPU% until Monday at 6 PM. At all other times scaling will be done according to the default profile, based on the number of requests. After 6 PM on Monday, autoscale switches to the default profile. If for example, the number of instances at the time is 12, autoscale scales in to 10, which the maximum allowed for the default profile.
4545

46+
## Multiple contiguous profiles
47+
Autoscale transitions between profiles based on their start times. The end time for a given profile is determined by the start time of the following profile.
48+
49+
In the portal, the end time field becomes the next start time for the default profile. You can't specify the same time for the end of one profile and the start of the next. The portal will force the end time to be one minute before the start time of the following profile. During this minute, the default profile will become active. If you don't want the default profile to become active between recurring profiles, leave the end time field empty.
50+
51+
> [!TIP]
52+
> To set up multiple contiguous profiles using the portal, leave the end time empty. The current profile will stop being used when the next profile becomes active. Only specify an end time when you want to revert to the default profile.
53+
4654
## Multiple profiles using templates, CLI, and PowerShell
4755

4856
When creating multiple profiles using templates, the CLI, and PowerShell, follow the guidelines below.
4957

5058
## [ARM templates](#tab/templates)
5159

52-
Follow the rules below when using ARM templates to create autoscale settings with multiple profiles:
53-
5460
See the autoscale section of the [ARM template resource definition](https://learn.microsoft.com/azure/templates/microsoft.insights/autoscalesettings) for a full template reference.
5561

56-
* Create a default profile for each recurring profile. If you have two recurring profiles, create two matching default profiles.
57-
* The default profile must contain a `recurrence` section that is the same as the recurring profile, with the `hours` and `minutes` elements set for the end time of the recurring profile. If you don't specify a recurrence with a start time for the default profile, the last recurrence rule will remain in effect.
58-
* The `name` element for the default profile is an object with the following format: `"name": "{\"name\":\"Auto created default scale condition\",\"for\":\"Recurring profile name\"}"` where the recurring profile name is the value of the `name` element for the recurring profile. If the name isn't specified correctly, the default profile will appear as another recurring profile.
59-
*The rules above don't apply for non-recurring scheduled profiles.
62+
There is no specification in the template for end time. A profile will remain active until the next profile's start time.
63+
6064

6165
## Add a recurring profile using AIM templates
6266

63-
The example below shows how to create two recurring profiles. One profile for weekends between 06:00 and 19:00, Saturday and Sunday, and a second for Mondays between 04:00 and 15:00. Note the two default profiles, one for each recurring profile.
67+
The example below shows how to create two recurring profiles. One profile for weekends from 00:01 on Saturday morning and a second Weekday profile starting on Mondays at 04:00. That means that the weekend profile will start on Saturday morning at one minute passed midnight and end on Monday morning at 04:00. The Weekday profile will start at 4am on Monday end just after midnight on Saturday morning.
6468

6569
Use the following command to deploy the template:
6670
` az deployment group create --name VMSS1-Autoscale-607 --resource-group rg-vmss1 --template-file VMSS1-autoscale.json`
@@ -83,7 +87,7 @@ where *VMSS1-autoscale.json* is the the file containing the JSON object below.
8387
"targetResourceUri": "/subscriptions/abc123456-987-f6e5-d43c-9a8d8e7f6541/resourceGroups/rg-vmss1/providers/Microsoft.Compute/virtualMachineScaleSets/VMSS1",
8488
"profiles": [
8589
{
86-
"name": "Monday profile",
90+
"name": "Weekday profile",
8791
"capacity": {
8892
"minimum": "3",
8993
"maximum": "20",
@@ -162,152 +166,16 @@ where *VMSS1-autoscale.json* is the the file containing the JSON object below.
162166
"schedule": {
163167
"timeZone": "E. Europe Standard Time",
164168
"days": [
165-
"Saturday",
166-
"Sunday"
169+
"Saturday"
167170
],
168171
"hours": [
169-
6
170-
],
171-
"minutes": [
172172
0
173-
]
174-
}
175-
}
176-
},
177-
{
178-
"name": "{\"name\":\"Auto created default scale condition\",\"for\":\"Weekend profile\"}",
179-
"capacity": {
180-
"minimum": "2",
181-
"maximum": "10",
182-
"default": "2"
183-
},
184-
"recurrence": {
185-
"frequency": "Week",
186-
"schedule": {
187-
"timeZone": "E. Europe Standard Time",
188-
"days": [
189-
"Saturday",
190-
"Sunday"
191-
],
192-
"hours": [
193-
19
194-
],
195-
"minutes": [
196-
0
197-
]
198-
}
199-
},
200-
"rules": [
201-
{
202-
"scaleAction": {
203-
"direction": "Increase",
204-
"type": "ChangeCount",
205-
"value": "1",
206-
"cooldown": "PT3M"
207-
},
208-
"metricTrigger": {
209-
"metricName": "Percentage CPU",
210-
"metricNamespace": "microsoft.compute/virtualmachinescalesets",
211-
"metricResourceUri": "/subscriptions/abc123456-987-f6e5-d43c-9a8d8e7f6541/resourceGroups/rg-vmss1/providers/Microsoft.Compute/virtualMachineScaleSets/VMSS1",
212-
"operator": "GreaterThan",
213-
"statistic": "Average",
214-
"threshold": 50,
215-
"timeAggregation": "Average",
216-
"timeGrain": "PT1M",
217-
"timeWindow": "PT1M",
218-
"Dimensions": [],
219-
"dividePerInstance": false
220-
}
221-
},
222-
{
223-
"scaleAction": {
224-
"direction": "Decrease",
225-
"type": "ChangeCount",
226-
"value": "1",
227-
"cooldown": "PT3M"
228-
},
229-
"metricTrigger": {
230-
"metricName": "Percentage CPU",
231-
"metricNamespace": "microsoft.compute/virtualmachinescalesets",
232-
"metricResourceUri": "/subscriptions/abc123456-987-f6e5-d43c-9a8d8e7f6541/resourceGroups/rg-vmss1/providers/Microsoft.Compute/virtualMachineScaleSets/VMSS1",
233-
"operator": "LessThan",
234-
"statistic": "Average",
235-
"threshold": 39,
236-
"timeAggregation": "Average",
237-
"timeGrain": "PT1M",
238-
"timeWindow": "PT3M",
239-
"Dimensions": [],
240-
"dividePerInstance": false
241-
}
242-
}
243-
]
244-
},
245-
{
246-
"name": "{\"name\":\"Auto created default scale condition\",\"for\":\"Monday profile\"}",
247-
"capacity": {
248-
"minimum": "2",
249-
"maximum": "10",
250-
"default": "2"
251-
},
252-
"recurrence": {
253-
"frequency": "Week",
254-
"schedule": {
255-
"timeZone": "E. Europe Standard Time",
256-
"days": [
257-
"Monday"
258-
],
259-
"hours": [
260-
15
261173
],
262174
"minutes": [
263-
0
175+
1
264176
]
265177
}
266-
},
267-
"rules": [
268-
{
269-
"scaleAction": {
270-
"direction": "Increase",
271-
"type": "ChangeCount",
272-
"value": "1",
273-
"cooldown": "PT3M"
274-
},
275-
"metricTrigger": {
276-
"metricName": "Percentage CPU",
277-
"metricNamespace": "microsoft.compute/virtualmachinescalesets",
278-
"metricResourceUri": "/subscriptions/abc123456-987-f6e5-d43c-9a8d8e7f6541/resourceGroups/rg-vmss1/providers/Microsoft.Compute/virtualMachineScaleSets/VMSS1",
279-
"operator": "GreaterThan",
280-
"statistic": "Average",
281-
"threshold": 50,
282-
"timeAggregation": "Average",
283-
"timeGrain": "PT1M",
284-
"timeWindow": "PT1M",
285-
"Dimensions": [],
286-
"dividePerInstance": false
287-
}
288-
},
289-
{
290-
"scaleAction": {
291-
"direction": "Decrease",
292-
"type": "ChangeCount",
293-
"value": "1",
294-
"cooldown": "PT3M"
295-
},
296-
"metricTrigger": {
297-
"metricName": "Percentage CPU",
298-
"metricNamespace": "microsoft.compute/virtualmachinescalesets",
299-
"metricResourceUri": "/subscriptions/abc123456-987-f6e5-d43c-9a8d8e7f6541/resourceGroups/rg-vmss1/providers/Microsoft.Compute/virtualMachineScaleSets/VMSS1",
300-
"operator": "LessThan",
301-
"statistic": "Average",
302-
"threshold": 39,
303-
"timeAggregation": "Average",
304-
"timeGrain": "PT1M",
305-
"timeWindow": "PT3M",
306-
"Dimensions": [],
307-
"dividePerInstance": false
308-
}
309-
}
310-
]
178+
}
311179
}
312180
],
313181
"notifications": [],
@@ -316,8 +184,7 @@ where *VMSS1-autoscale.json* is the the file containing the JSON object below.
316184

317185
}
318186
]
319-
}
320-
187+
}
321188
```
322189

323190
## [CLI](#tab/cli)
@@ -428,8 +295,8 @@ $DefaultProfileThursdayProfile = New-AzAutoscaleProfile -DefaultCapacity "1" -Ma
428295

429296
* [Autoscale CLI reference](https://learn.microsoft.com/cli/azure/monitor/autoscale?view=azure-cli-latest)
430297
* [ARM template resource definition](https://learn.microsoft.com/azure/templates/microsoft.insights/autoscalesettings)
431-
* [PowerShell Az.Monitor Reference](https://learn.microsoft.com/powershell/module/az.monitor/#monitor)
298+
* [PowerShell Az PowerShell module.Monitor Reference](https://learn.microsoft.com/powershell/module/az.monitor/#monitor)
432299
* [REST API reference. Autoscale Settings](https://learn.microsoft.com/rest/api/monitor/autoscale-settings).
433-
* [Tutorial: Automatically scale a virtual machine scale set with an Azure template](https://learn.microsoft.com/azure/virtual-machine-scale-sets/tutorial-autoscale-template)
434-
* [Tutorial: Automatically scale a virtual machine scale set with the Azure CLI](https://learn.microsoft.com/azure/virtual-machine-scale-sets/tutorial-autoscale-cli)
435-
* [Tutorial: Automatically scale a virtual machine scale set with an Azure template](https://learn.microsoft.com/azure/virtual-machine-scale-sets/tutorial-autoscale-powershell)
300+
* [Tutorial: Automatically scale a Virtual Machine Scale Set with an Azure template](https://learn.microsoft.com/azure/virtual-machine-scale-sets/tutorial-autoscale-template)
301+
* [Tutorial: Automatically scale a Virtual Machine Scale Set with the Azure CLI](https://learn.microsoft.com/azure/virtual-machine-scale-sets/tutorial-autoscale-cli)
302+
* [Tutorial: Automatically scale a Virtual Machine Scale Set with an Azure template](https://learn.microsoft.com/azure/virtual-machine-scale-sets/tutorial-autoscale-powershell)

0 commit comments

Comments
 (0)