Documentation menu

resources

Function App

Overview

A Function App requires an App Service plan and a storage account. Use Consumption, EP1–EP3, or a Dedicated plan for a classic Function App. Use FlexConsumption for a Linux Flex Consumption app.

This classic example can be redeployed safely with hulk transpile and az deployment group create:

{
	"resources": [
		{
			"storage_account": {
				"name": "stfunctions{env}",
				"kind": "StorageV2",
				"sku": "Standard_LRS"
			}
		},
		{
			"app_service_plan": {
				"name": "plan-functions-{env}",
				"kind": "Consumption",
				"os": "windows",
				"type": "function_app"
			}
		},
		{
			"function_app": {
				"name": "func-app-{env}",
				"@plan_name": "plan-functions-{env}",
				"@storage_account_name": "stfunctions{env}",
				"runtime": "dotnetisolated8",
				"https_only": true,
				"app_settings": [
					{
						"type": "String",
						"name": "MY_APP_SETTING",
						"value": "MY_APP_SETTING_VALUE",
						"slot": false
					}
				]
			}
		}
	]
}

Flex Consumption

Microsoft recommends Flex Consumption for new serverless Function Apps. Hulk models Flex explicitly instead of expressing its configuration as legacy app settings.

The deployment container must exist on the referenced storage account. For a Hulk-managed storage account, declare it in containers as shown below:

{
	"resources": [
		{
			"storage_account": {
				"name": "stflex{env}",
				"allow_public_access": false,
				"kind": "StorageV2",
				"sku": "Standard_LRS",
				"containers": [
					{
						"name": "deployments",
						"public_access": "None"
					}
				]
			}
		},
		{
			"app_service_plan": {
				"name": "plan-flex-{env}",
				"kind": "FlexConsumption",
				"os": "linux",
				"type": "function_app"
			}
		},
		{
			"function_app": {
				"name": "func-flex-{env}",
				"@plan_name": "plan-flex-{env}",
				"@storage_account_name": "stflex{env}",
				"runtime": "dotnetisolated8",
				"https_only": true,
				"flex_settings": {
					"container_name": "deployments",
					"instance_memory": "2048",
					"maximum_instance_count": 100,
					"http_concurrency": 16,
					"always_ready": {
						"http": 2,
						"function:processOrder": 1
					}
				}
			}
		}
	]
}

Hulk generates the Microsoft-documented Flex shape:

  • An FC1 / FlexConsumption Linux plan.
  • A Microsoft.Web/sites@2024-04-01 Function App with functionAppConfig for the deployment source, runtime, memory, scale limit, HTTP concurrency, and always-ready instances.
  • A system-assigned managed identity, identity-based host storage settings, and access to the deployment blob container.
  • An explicit dependency on the deployment container so the app isn’t created before its package location exists.

See Azure Functions Flex Consumption hosting and Automate Function App resource deployment for the underlying Azure behavior.

Flex requirements and limitations

  • The plan must use kind: "FlexConsumption", os: "linux", and type: "function_app".
  • flex_settings is required for a Function App on a Flex plan and is rejected for other plans.
  • Flex doesn’t support deployment slots. Hulk rejects an enabled slot_settings definition.
  • .NET must use the isolated worker model (dotnetisolated8 in the currently supported Hulk schema); in-process .NET is rejected.
  • A Flex plan should contain only one Function App. Moving an existing app between Flex and another hosting plan isn’t an in-place migration.
  • Azure runtime and regional availability change over time. Confirm that the selected Hulk runtime is available in the target region before deployment.

FlexSettings

Key Type Description
container_name (required) string Blob container used for code deployment. It must already exist; Hulk validates this for managed storage accounts.
instance_memory 512, 2048, or 4096 Memory in MB for each instance. Defaults to 2048.
maximum_instance_count integer Maximum on-demand instances for each independently scaling function group. Hulk accepts 40–1000 and defaults to 40.
http_concurrency integer Maximum concurrent HTTP requests per instance. Accepted range is 1–1000; omit it to use the platform default for the selected memory size.
always_ready object Map of scale-group or function name to the number of always-ready instances. Defaults to none.

For always_ready, Microsoft-defined group names include http, blob, and durable. Other triggers can target an individual function using function:<FUNCTION_NAME>.

Redeployment behavior

Azure’s app-settings API replaces the complete settings collection during an infrastructure deployment. A missing platform setting can therefore leave an otherwise successful Function App deployment unable to start.

For classic Function Apps and slots, Hulk reads and reuses the existing platform-generated WEBSITE_CONTENTSHARE value before it updates app settings. On the first deployment, Hulk creates a deterministic, app-specific file share. This keeps repeated hulk transpile plus az deployment group create runs idempotent and prevents multiple apps or slots from sharing a content share accidentally.

Flex Consumption uses a blob deployment container through functionAppConfig and doesn’t use the classic WEBSITE_CONTENTSHARE deployment pattern.

The app_settings array remains the Hulk-managed configuration. Declare application settings in source control instead of relying on undeclared settings added manually in Azure. Reserved platform settings are generated by Hulk and cannot be overridden in app_settings.

Function App definition

Key Type Description
name (required) string Function App name.
@plan_name (required) App Service plan reference Plan defined in the same Hulk configuration. Its type must be function_app.
@storage_account_name (required) storage account reference Storage used by the Functions host and, for Flex, by the deployment container.
runtime (required) Runtime Language worker and version.
flex_settings FlexSettings Required only for Flex Consumption.
@application_insights_name Application Insights reference Adds Application Insights configuration.
diagnostic_settings diagnostic settings Sends supported logs and metrics to configured destinations.
app_settings array of AppSetting Hulk-managed application settings.
run_from_package boolean Enables run-from-package for classic plans. Defaults to true. Flex configures its deployment source through flex_settings.
instance_count integer Classic plan instance count. Defaults to 1; Flex scaling is configured in flex_settings.
max_instance_burst_count integer Classic dynamic scale-out limit. Defaults to 100; Flex uses maximum_instance_count.
is_64bit boolean Enables a 64-bit worker process. Defaults to false where applicable.
https_only boolean Require HTTPS. Recommended as true for new apps. If omitted, Hulk leaves the existing Azure value unchanged.
client_affinity_enabled boolean Enable client-affinity cookies. If omitted, Hulk leaves the existing Azure value unchanged.
custom_domains array of CustomDomain Custom domains.
cors CORS CORS configuration.
vnet_config VirtualNetwork Virtual network integration.
slot_settings SlotSettings Classic deployment slot configuration. Not supported on Flex.
location string Defaults to the resource group location.
external boolean Reference an existing Function App. Defaults to false.
resource_group_name string Resource group for an external resource; otherwise defaults to the deployment resource group.
tags object Additional resource tags.

Runtime

Value Worker
node18 Node.js 18
node20 Node.js 20
dotnetisolated6 .NET 6 isolated worker
dotnetisolated8 .NET 8 isolated worker
dotnetinprocess6 .NET 6 in-process worker; not supported on Flex
dotnetinprocess8 .NET 8 in-process worker; not supported on Flex
java17 Java 17
powershell7_4 PowerShell 7.4
python3_11 Python 3.11
custom Custom handler

AppSetting

Key Description
type (required) String or KeyVault.
name (required) Application setting name. Reserved Functions settings aren’t allowed.
value (required for String) Literal string value.
@key_vault_name (for KeyVault) Referenced Key Vault.
secret_name (for KeyVault) Secret name in the Key Vault.
slot Marks a classic setting as slot-sticky. Defaults to false.

CustomDomain

Key Description
custom_domain Fully qualified custom domain.
@dns_zone_name Azure DNS zone reference.
dns_zone_resource_group Resource group containing the DNS zone.

VirtualNetwork

Key Type Description
@vnet_name string Virtual network reference.
@subnet_name string Subnet reference.

SlotSettings

Key Type Description
enabled (required) boolean Enables the classic deployment slot.
name string Slot name. Defaults to preprod.

CORS

Key Type Description
allowed_origins (required) string[] Allowed origins.
support_credentials (required) boolean Whether credentialed requests are allowed.