Automation
Azure Functions: diagnose a VNet trigger that will not scale before adding instances
A production runbook for separating worker health, private trigger access, runtime scale monitoring, extension compatibility and downstream capacity before increasing Azure Functions minimum instances.
A Service Bus queue behind network restrictions accumulates messages. Its Azure Functions consumer is still running on Elastic Premium, but the instance count remains close to the prewarmed floor and the oldest message age keeps rising. Raising minimum instances looks like the quickest recovery.
That action can buy throughput without fixing event-driven scaling. One warm worker may reach the private namespace while the scaling path is disabled, unsupported by the installed trigger extension or unable to observe the source correctly. This runbook separates those contracts, validates one bounded change and ends with a promote, hold or rollback decision.
Freeze the scaling contract
Record the hosting plan, trigger type, extension version, namespace, entity, connection mode, virtual network integration, private DNS path, current instance floor and ceiling, and the first UTC time when backlog growth diverged from throughput. Preserve the deployed application settings and host.json before changing capacity.
incident: INC-FUNC-431
function_app: orders-consumer-prod
hosting_plan: elastic-premium
trigger:
type: service-bus
namespace: sb-orders-prod
entity: orders
authentication: managed-identity
network:
restricted_source: true
integration_subnet: snet-functions-prod
observed:
backlog_started_at: 2026-10-31T14:10:00Z
active_messages: 18420
oldest_message_age_seconds: 1260
running_instances: 1
prewarmed_instances: 1
change_window:
owner: platform-on-call
rollback_deadline: 2026-10-31T17:00:00Z Capture both queue depth and message age. A stable queue with old messages, a fast-growing queue, and a queue receiving messages faster than its agreed peak are different incidents. Also record completion, abandonment, dead-letter and dependency error rates; a consumer can look busy while repeatedly failing the same work.
Separate worker reachability from scaling reachability
A successful invocation proves that at least one Functions host can resolve, connect to and authenticate against the trigger source. It does not prove that the app can scale from the event stream.
On Elastic Premium, a non-HTTP source restricted to a virtual network is a virtual network trigger. Dynamic scale for supported extensions requires runtime scale monitoring to be enabled. The runtime then participates in monitoring the trigger from the app’s network context. Flex Consumption natively supports virtual network triggers and has a different per-function scaling model. Dedicated App Service plans use App Service scaling rather than Functions event-driven scale.
Confirm the plan before applying a plan-specific fix. Do not copy an Elastic Premium setting into a Flex investigation, and do not expect a Dedicated plan to react like Premium.
RG="rg-app-prod"
APP="orders-consumer-prod"
az functionapp show --resource-group "$RG" --name "$APP" --query '{state:state,kind:kind,plan:serverFarmId,vnet:virtualNetworkSubnetId,outbound:outboundIpAddresses}' --output json
az resource show --resource-group "$RG" --resource-type Microsoft.Web/sites/config --name "$APP/web" --query 'properties.{runtimeScaleMonitoring:functionsRuntimeScaleMonitoringEnabled,routeAll:vnetRouteAllEnabled,alwaysOn:alwaysOn}' --output json
az functionapp config appsettings list --resource-group "$RG" --name "$APP" --query "[?contains(name, 'SERVICEBUS') || name == 'FUNCTIONS_EXTENSION_VERSION' || name == 'WEBSITE_MAX_DYNAMIC_APPLICATION_SCALE_OUT'].{name:name,value:value}" --output table Do not paste connection strings or application-setting values into the incident record. For identity-based connections, retain only the setting names, fully qualified namespace, selected client ID when applicable and the runtime principal expected to receive data-plane access.
Verify that the trigger extension can participate
Runtime scale monitoring only helps trigger extensions that implement the required scale contract. Check the deployed extension package and version in the build manifest, not the version on a developer workstation. Microsoft documents minimum extension versions for virtual network trigger monitoring and newer versions for target-based scaling; for Service Bus, target-based scaling requires a newer extension generation than basic runtime monitoring.
The useful comparison is:
- the package or extension bundle declared by the release;
- the package resolved in the deployed artifact;
- the trigger type discovered by the Functions host;
- the capability supported by that exact version.
If the extension is too old, prepare a normal application release with dependency tests and a rollback artifact. Do not upgrade packages during an incident by editing the live site. If the extension is supported but the host reports indexing or listener failures, fix those first: no scaling algorithm can compensate for a trigger that was never loaded.
Prove the private source path from the app
The runtime scale monitor and the listener need the same trigger contract to be usable from the integrated app. Validate DNS, TCP/TLS and authorization from an approved console in the function app environment or from a diagnostic workload attached to the same integration subnet and DNS configuration.
For Service Bus, resolve the normal <namespace>.servicebus.windows.net name. With Private Link, its chain should lead to the approved private address from the workload path. A private IP alone is not sufficient: verify the namespace, port, TLS name and real managed identity authorization.
NAMESPACE="sb-orders-prod.servicebus.windows.net"
nslookup "$NAMESPACE"
openssl s_client -connect "$NAMESPACE:5671" -servername "$NAMESPACE" -brief </dev/null A DNS or TLS probe does not prove message access. Correlate it with a fresh receive attempt from the deployed function identity, Service Bus diagnostic evidence and a real invocation. Keep network and authorization distinct: a timeout or name-resolution failure belongs to the path; an explicit 401 or 403 after connection belongs to identity or data-plane roles.
Also inspect the integration subnet NSG, effective routes, custom DNS forwarding and any firewall path. VNet integration is outbound connectivity from the app. An inbound private endpoint on the function app does not make the trigger source reachable.
Build one timeline from backlog, instances and executions
Use one UTC window covering healthy behavior, the start of divergence and the proposed change. Azure Monitor metrics should show whether messages arrive faster, completions fall, instances stay flat or the target begins throttling. Application traces should explain invocation and dependency failures, not replace source-side metrics.
let start = datetime(2026-10-31T13:30:00Z);
let stop = datetime(2026-10-31T16:30:00Z);
AzureMetrics
| where TimeGenerated between (start .. stop)
| where ResourceProvider == "MICROSOFT.SERVICEBUS"
| where MetricName in ("ActiveMessages", "IncomingMessages", "CompletedMessages", "ThrottledRequests")
| summarize Value = max(Maximum) by bin(TimeGenerated, 5m), MetricName, ResourceId
| order by TimeGenerated asc Adapt aggregation to the metric contract exported by the namespace. Alongside this query, graph function execution count, failures, duration and worker instance count using the monitoring source already approved for the app. Keep the same five-minute buckets and annotate deployments, network changes and setting updates.
Interpret the combination:
- backlog rises, executions remain healthy and instances stay at the floor: investigate scale monitoring and limits;
- instances rise but completions do not: investigate concurrency, downstream latency, locks or poison work;
- throttling rises with scale-out: stop promotion and protect the dependency;
- no source metrics exist: repair evidence before claiming a scaling failure.
Check host.json concurrency and trigger settings only after the scale path is known. High per-instance concurrency can overload a dependency; low concurrency can make each instance intentionally conservative. Changing concurrency and instance count together destroys the comparison.
Canary runtime scale monitoring
On Elastic Premium, enable runtime scale monitoring only after the extension and private path have been qualified. The setting update restarts the app, so announce the interruption risk and preserve the before state.
RG="rg-app-prod"
APP="orders-consumer-prod"
az resource update --resource-group "$RG" --resource-type Microsoft.Web/sites/config --name "$APP/web" --set properties.functionsRuntimeScaleMonitoringEnabled=1
az resource show --resource-group "$RG" --resource-type Microsoft.Web/sites/config --name "$APP/web" --query 'properties.functionsRuntimeScaleMonitoringEnabled' --output tsv Prefer a canary function app and queue with representative private networking, identity and extension versions. If production is the only valid path, bound the observation window and retain the existing maximum instance limit. Runtime scale monitoring can add a small amount of application overhead; watch CPU, memory, listener errors and processing latency as well as the instance count.
Promotion requires more than seeing a second worker. Confirm that fresh instances load the trigger, receive with the intended identity, reduce oldest-message age, keep dead-letter growth controlled and stay within Service Bus and downstream capacity. Let the backlog drain at a rate the entire system can sustain.
Decide before changing the floor
PROMOTE RUNTIME SCALE MONITORING
Elastic Premium plan confirmed
Deployed trigger extension supports the scale contract
Private DNS, TLS and data-plane authorization are proven
Canary adds workers and reduces oldest-message age
Error, dead-letter and downstream throttling rates stay acceptable
HOLD
Plan behavior is not identified
Trigger extension or listener state is unknown
Backlog and completion metrics cannot be correlated
Private source reachability is not proven
Incoming rate exceeds the documented processing envelope
ROLL BACK
Restore functionsRuntimeScaleMonitoringEnabled to its previous value
Wait for the app restart and listener initialization
Restore the previous deployment if an extension changed
Keep a temporary instance floor only as an owned containment measure
Re-run the same backlog, age, execution and dependency checks Increasing prewarmed or minimum instances can remain a temporary containment action when the business impact demands it. Give that action an owner, expiry and capacity ceiling. It is not the final repair unless the workload deliberately requires a fixed warm floor.
If enabling runtime monitoring causes listener instability, dependency throttling or unacceptable overhead, return the setting to its captured value and restore the previous release when an extension upgrade was part of the canary. Validate rollback with the same source-side and application-side evidence; a successful configuration write is not proof that consumption recovered.
Conclusion
A private Azure Functions trigger has two operational paths: a worker must process events, and the platform must obtain enough trigger evidence to add workers safely. One healthy prewarmed instance proves only the first path.
The production decision should follow the evidence. Promote runtime scale monitoring when the plan, extension, private path and canary agree. Hold when the source or telemetry contract is unclear. Roll back when scale-out harms the listener or its dependencies. Raise the fixed instance floor only as a bounded containment measure, then remove it after event-driven scaling is proven.