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

KeyValueDescription
name (required)stringThe name of the plan (see how to name)
kind (required)PlanKindKind of the App Service Plan
os (required)OsTypeThe target os of the plan
type (required)AppTypeThe type of the plan
@log_analytics_workspace_namestring (reference to a log workspace)The name of the workspace that you want to attach to (defaults to no log integration)
zone_redundantboolWhether the plan is redundant inside of the location, will impact instance count (defaults to false)
auto_scale_settingsAutoScaleThe settings for the auto scale
locationstringResource Location (defaults to the resource group location)
externalboolA reference to an existing App Service Plan (defaults to false)
resource_group_namestringThe name of the resource group where the resource is located, only with external resources (defaults to the resource group of the deployment)
tagsobjectAdditional tags for the resource (defaults to no additional tags)

PlanKind

Value
B1
Consumption
EP1
EP2
EP3
P1v2
P1v3
P2v2
P2v3
P3v2
P3v3
S1

OsType

ValueDescription
windowsA plan running on Windows
linuxA plan running on Linux

AppType

ValueDescription
function_appDefines a function app
web_appDefines a web app

AutoScale

KeyTypeDescription
namestringName of the AutoScale Setting
enabledboolWether the AutoScale should be enabled
notificationsarray of AutoScaleNotificationsNotification Settings of the AutoScale Setting
profilesarray of AutoScaleProfilesProfiles of the AutoScale Setting

AutoScaleNotifications

ValueTypeDescription
operationScaleOperationOperation that will trigger the notifications
emailsarray of stringCustom emails to notify
send_to_subscription_administratorboolWether an email should be sent to subscription administrators

ScaleOperation

ValueDescription
ScaleTriggers when the scale changes

AutoScaleProfiles

ValueTypeDescription
namestringA plan running on Windows
capacityAutoScaleCapacityCapacity of the Profile
rulesarray of object AutoScaleRulesList of rules for the Profile

AutoScaleCapacity

ValueTypeDescription
defaultnumberDefault instance count of the Profile
minimumnumberMinimum instance count of the Profile
maximumnumberMaximum instance count of the Profile

AutoScaleRules

ValueTypeDescription
metric_triggerMetricTriggerMetric trigger of the rule
scale_actionScaleActionScale action of the rule

MetricTrigger

ValueTypeDescription
metric_nameMetricNameName of the metric to monitor for triggers
time_grainTimeSpanGranularity of Metrics
statisticStatisticMetric statistic type
time_windowTimeSpanTime range in which instance data is collected
time_aggregationTimeAggregationTime aggregation type
operatorOperatorOperator used for comparing metric data and threshold
thresholdnumberThe 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

ValueTypeDescription
directionScaleDirectionThe scale direction
typeScaleTypeThe action type when scaling
valuenumberThe number of instances involvded in the scaling action
cooldownTimeSpanThe amount of time to wait between scale actions

ScaleDirection

Value
Decrease
Increase
None

ScaleType

Value
ChangeCount
ExactCount
PercentChangeCount