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/azure-monitor/autoscale/autoscale-multiprofile.md
+41-34Lines changed: 41 additions & 34 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,57 +15,57 @@ ms.reviewer: akkumari
15
15
16
16
# Autoscale with different profiles
17
17
18
-
Scaling your resources for a particular day of the week, or a specific date and time can reduce costs while still providing the capacity you need when you need it.
18
+
Scaling your resources for a particular day of the week, or a specific date and time can reduce your costs while still providing the capacity you need when you need it.
19
19
20
-
Use multiple profiles in autoscale to scale in different ways at different times. If for example, your business isn't active on the weekend, create a recurring profile to scale in your resources on Saturdays and Sundays. If black Friday is a busy day, create a profile to automatically scale out your resources on black Friday.
20
+
You can use multiple profiles in autoscale to scale in different ways at different times. If for example, your business isn't active on the weekend, create a recurring profile to scale in your resources on Saturdays and Sundays. If black Friday is a busy day, create a profile to automatically scale out your resources on black Friday.
21
21
22
22
This article explains the different profiles in autoscale and how to use them.
23
23
24
24
You can have one or more profiles in your autoscale setting.
25
25
26
26
There are three types of profile:
27
27
28
+
* The default profile. The default profile is created automatically and isn't dependent on a schedule. The default profile can't be deleted. The default profile is used when there are no other profiles that match the current date and time.
28
29
* Recurring profiles. A recurring profile is valid for a specific time range and repeats for selected days of the week.
29
30
* Fixed date and time profiles. A profile that is valid for a time range on a specific date.
30
-
* The default profile. The default profile is created automatically and isn't dependent on a schedule. The default profile can't be deleted. The default profile is used when there are no other profiles that match the current date and time.
31
-
31
+
32
+
32
33
Each time the autoscale service runs, the profiles are evaluated in the following order:
33
34
34
35
1. Fixed date profiles
35
36
1. Recurring profiles
36
37
1. Default profile
37
38
38
-
If a profile's date and time conditions match the current time, autoscale will apply that profile's limits and rules. Only the first applicable profile is used.
39
+
If a profile's date and time settings match the current time, autoscale will apply that profile's rules and capacity limits. Only the first applicable profile is used.
39
40
40
41
The example below shows an autoscale setting with a default profile and recurring profile.
41
42
42
43
:::image type="content" source="./media/autoscale-multiple-profiles/autoscale-default-recurring-profiles.png" alt-text="A screenshot showing an autoscale setting with default and recurring profile or scale condition":::
43
44
44
-
On Monday after 6 AM, the recurring profile will be used. If the instance count is two, autoscale scales to the new minimum of three. Autoscale continues to use this profile and scales based on CPU% until Monday at 6 PM.
45
-
46
-
At all other times scaling will be done according to the default profile, based on the number of requests.
47
-
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.
45
+
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.
48
46
49
-
## Multiple profiles using templatesand CLI
47
+
## Multiple profiles using templates, CLI, and PowerShell
50
48
51
-
When creating multiple profiles using templates and the CLI, follow the guidelines below.
49
+
When creating multiple profiles using templates, the CLI, and PowerShell, follow the guidelines below.
52
50
53
51
## [ARM templates](#tab/templates)
54
52
55
53
Follow the rules below when using ARM templates to create autoscale settings with multiple profiles:
56
54
55
+
See the autoscale section of the [ARM template resource definition](https://learn.microsoft.com/azure/templates/microsoft.insights/autoscalesettings) for a full template reference.
56
+
57
57
* Create a default profile for each recurring profile. If you have two recurring profiles, create two matching default profiles.
58
58
* 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.
59
-
These rules don't apply for a non-recurring scheduled profile.
60
59
* 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.
60
+
*The rules above don't apply for non-recurring scheduled profiles.
61
61
62
62
## Add a recurring profile using AIM templates
63
63
64
64
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.
65
65
66
66
Use the following command to deploy the template:
67
67
` az deployment group create --name VMSS1-Autoscale-607 --resource-group rg-vmss1 --template-file VMSS1-autoscale.json`
68
-
where `VMSS1-autoscale.json` is the the file containing the JSON object below.
68
+
where *VMSS1-autoscale.json* is the the file containing the JSON object below.
69
69
70
70
```JSON
71
71
{
@@ -325,9 +325,12 @@ where `VMSS1-autoscale.json` is the the file containing the JSON object below.
325
325
326
326
The CLI can be used to create multiple profiles in your autoscale settings.
327
327
328
-
The following steps show how to create an autoscale profile using the CLI.
329
-
1. Create the profile using `az monitor autoscale profile create`. Specify the `--start` and `--end` time and the `--recurrence`
330
-
1. Create a scale-out rule using `az monitor autoscale rule create` using `--scale out`
328
+
See the [Autoscale CLI reference](https://learn.microsoft.com/cli/azure/monitor/autoscale?view=azure-cli-latest) for the full set of autoscale CLI commands.
329
+
330
+
The following steps show how to create a recurring autoscale profile using the CLI.
331
+
332
+
1. Create the recurring profile using `az monitor autoscale profile create`. Specify the `--start` and `--end` time and the `--recurrence`
333
+
1. Create a scale out rule using `az monitor autoscale rule create` using `--scale out`
331
334
1. Create a scale in rule using `az monitor autoscale rule create` using `--scale in`
> The JSON for your autoscale default profile is modified by adding a recurring profile.
348
-
> The `name` of the default profile is changed to an object in the format: `"name": "{\"name\":\"Auto created default scale condition\",\"for\":\"recurring profile\"}"` where *recurring profile* is the profile name from the `az monitor autoscale profile create` command.
351
+
> The `name`element of the default profile is changed to an object in the format: `"name": "{\"name\":\"Auto created default scale condition\",\"for\":\"recurring profile\"}"` where *recurring profile* is the profile name of your recurring profile.
349
352
> The default profile also has a recurrence clause added to it that starts at the end time specified for the new recurring profile.
350
353
> A new default profile is created for each recurring profile.
az monitor autoscale rule create -g rg-vmss1--autoscale-name VMSS1-Autoscale-607 --scale out 8 --condition "Percentage CPU > 52 avg 5m" --profile-name "{\"name\": \"Auto created default scale condition\", \"for\": \"Thursdays\"}"
362
365
```
363
366
364
-
## [Powershell](#tab/powershell)
367
+
## [PowerShell](#tab/powershell)
365
368
366
-
Powershell can be used to create multiple profiles in your autoscale settings.
369
+
PowerShell can be used to create multiple profiles in your autoscale settings.
367
370
368
-
The following steps show how to create an autoscale profile using Powershell.
371
+
See the [PowerShell Az.Monitor Reference ](https://learn.microsoft.com/powershell/module/az.monitor/#monitor) for the full set of autoscale PowerShell commands.
369
372
370
-
1. Create rules using `New-AzAutoscaleRule`
371
-
1. Create profiles using `New-AzAutoscaleProfile` using the rules from the previous step
372
-
1. Use `Add-AzureRmAutoscaleSetting` to apply the profiles to your autoscale setting.
373
+
The following steps show how to create an autoscale profile using PowerShell.
373
374
374
-
## Add a recurring profile using Powershell
375
+
1. Create rules using `New-AzAutoscaleRule`.
376
+
1. Create profiles using `New-AzAutoscaleProfile` using the rules from the previous step.
377
+
1. Use `Add-AzAutoscaleSetting` to apply the profiles to your autoscale setting.
378
+
379
+
## Add a recurring profile using PowerShell
375
380
376
381
The example below shows how to create default profile and a recurring autoscale profile, recurring on Wednesdays and Fridays between 07:00 and 19:00.
377
-
The default profile uses the CpuIn and CpuOut Rules. The recurring profile uses the HTTPRuleIn and HTTPRuleOut rules
382
+
The default profile uses the `CpuIn` and `CpuOut` Rules. The recurring profile uses the `HTTPRuleIn` and `HTTPRuleOut` rules
> Each recurring profile must have a corresponding default profile.
402
-
> The `-Name` parameter of the default profile is is an object in the format: `'{"name":"Default scale condition","for":"recurring profile"}'` where *recurring profile* is the profile name from the `New-AzAutoscaleProfile` command for the recurring profile.
403
-
> The default profile also has a recurrence parameters as the recurring profile but it starts at the time you want the recurring profile to end.
404
-
> A distinct default profile is created for each recurring profile.
407
+
> The `-Name` parameter of the default profile is an object in the format: `'{"name":"Default scale condition","for":"recurring profile"}'` where *recurring profile* is the profile name of the recurring profile.
408
+
> The default profile also has a recurrence parameters which match the recurring profile but it starts at the time you want the recurring profile to end.
409
+
> Create a distinct default profile for each recurring profile.
405
410
406
411
## Updating the default profile when you have recurring profiles
*[REST API reference. Autoscale Settings](https://learn.microsoft.com/rest/api/monitor/autoscale-settings).
427
434
*[Advanced autoscale configuration using Resource Manager templates for virtual machine scale sets](autoscale-virtual-machine-scale-sets.md) for different resources in Azure.
0 commit comments