App Service Plan
Overview
This example defines an App Service plan for function apps on windows.
{
"app_service_plan": {
"name": "plan-consump-{env}",
"kind": "Consumption",
"os": "linux",
"type": "function_app",
"@log_analytics_workspace_name": "log-workspace-{env}",
"zone_redundant": false,
"auto_scale_settings": {
"name": "autoscale-plan-consump-{env}",
"enabled": true,
"notifications": [
{
"operation": "Scale",
"emails": [
"contoso@cyncly.com"
],
"send_to_subscription_administrator": true
}
],
"profiles": [
{
"name": "Default",
"capacity": {
"default": 2,
"maximum": 3,
"minimum": 2
},
"rules": [
{
"metric_trigger": {
"metric_name": "CpuPercentage",
"time_grain": "PT1M",
"statistic": "Average",
"time_window": "PT10M",
"time_aggregation": "Average",
"operator": "GreaterThan",
"threshold": 70
},
"scale_action": {
"direction": "Increase",
"type": "ChangeCount",
"value": 1,
"cooldown": "PT5M"
}
},
{
"metric_trigger": {
"metric_name": "CpuPercentage",
"time_grain": "PT1M",
"statistic": "Average",
"time_window": "PT10M",
"time_aggregation": "Average",
"operator": "LessThan",
"threshold": 40
},
"scale_action": {
"direction": "Decrease",
"type": "ChangeCount",
"value": 1,
"cooldown": "PT5M"
}
}
]
}
]
},
"location": "northeurope",
"external": false,
"resource_group_name": "my-rg-name",
"tags": { "example": "S0" }
}
}
App Service Plan Reference
| Key | Value | Description |
|---|
name (required) | string | The name of the plan (see how to name) |
kind (required) | PlanKind | Kind of the App Service Plan |
os (required) | OsType | The target os of the plan |
type (required) | AppType | The type of the plan |
@log_analytics_workspace_name | string (reference to a log workspace) | The name of the workspace that you want to attach to (defaults to no log integration) |
zone_redundant | bool | Whether the plan is redundant inside of the location, will impact instance count (defaults to false) |
auto_scale_settings | AutoScale | The settings for the auto scale |
location | string | Resource Location (defaults to the resource group location) |
external | bool | A reference to an existing App Service Plan (defaults to false) |
resource_group_name | string | The name of the resource group where the resource is located, only with external resources (defaults to the resource group of the deployment) |
tags | object | Additional tags for the resource (defaults to no additional tags) |
PlanKind
| Value |
|---|
B1 |
Consumption |
EP1 |
EP2 |
EP3 |
P1v2 |
P1v3 |
P2v2 |
P2v3 |
P3v2 |
P3v3 |
S1 |
OsType
| Value | Description |
|---|
windows | A plan running on Windows |
linux | A plan running on Linux |
AppType
| Value | Description |
|---|
function_app | Defines a function app |
web_app | Defines a web app |
AutoScale
| Key | Type | Description |
|---|
name | string | Name of the AutoScale Setting |
enabled | bool | Wether the AutoScale should be enabled |
notifications | array of AutoScaleNotifications | Notification Settings of the AutoScale Setting |
profiles | array of AutoScaleProfiles | Profiles of the AutoScale Setting |
AutoScaleNotifications
| Value | Type | Description |
|---|
operation | ScaleOperation | Operation that will trigger the notifications |
emails | array of string | Custom emails to notify |
send_to_subscription_administrator | bool | Wether an email should be sent to subscription administrators |
ScaleOperation
| Value | Description |
|---|
Scale | Triggers when the scale changes |
AutoScaleProfiles
| Value | Type | Description |
|---|
name | string | A plan running on Windows |
capacity | AutoScaleCapacity | Capacity of the Profile |
rules | array of object AutoScaleRules | List of rules for the Profile |
AutoScaleCapacity
| Value | Type | Description |
|---|
default | number | Default instance count of the Profile |
minimum | number | Minimum instance count of the Profile |
maximum | number | Maximum instance count of the Profile |
AutoScaleRules
| Value | Type | Description |
|---|
metric_trigger | MetricTrigger | Metric trigger of the rule |
scale_action | ScaleAction | Scale action of the rule |
MetricTrigger
| Value | Type | Description |
|---|
metric_name | MetricName | Name of the metric to monitor for triggers |
time_grain | TimeSpan | Granularity of Metrics |
statistic | Statistic | Metric statistic type |
time_window | TimeSpan | Time range in which instance data is collected |
time_aggregation | TimeAggregation | Time aggregation type |
operator | Operator | Operator used for comparing metric data and threshold |
threshold | number | The threhold of the metric |
MetricName
| Value |
|---|
CpuPercentage |
MemoryPercentage |
DiskQueueLength |
HttpQueueLength |
BytesReceived |
BytesSent |
TcpSynSent |
TcpSynReceived |
TcpEstablished |
TcpFinWait1 |
TcpFinWait2 |
TcpClosing |
TcpCloseWait |
TcpLastAck |
TcpTimeWait |
SocketInboundAll |
SocketOutboundAll |
SocketOutboundEstablished |
SocketOutboundTimeWait |
SocketLoopback |
Statistic
| Value |
|---|
Average |
Count |
Max |
Min |
Sum |
TimeAggregation
| Value |
|---|
Average |
Count |
Last |
Maximum |
Minimum |
Total |
Operator
| Value |
|---|
Equals |
GreaterThan |
GreaterThanOrEqual |
LessThan |
LessThanOrEqual |
NotEquals |
ScaleAction
| Value | Type | Description |
|---|
direction | ScaleDirection | The scale direction |
type | ScaleType | The action type when scaling |
value | number | The number of instances involvded in the scaling action |
cooldown | TimeSpan | The amount of time to wait between scale actions |
ScaleDirection
| Value |
|---|
Decrease |
Increase |
None |
ScaleType
| Value |
|---|
ChangeCount |
ExactCount |
PercentChangeCount |