Overview
Azure Functions is a powerful serverless compute service that enables you to run event-driven code without managing infrastructure. When you deploy a Function App, the Azure Functions host is the runtime process responsible for discovering your functions, loading extensions and bindings, connecting to storage, and starting trigger listeners.
A host startup issue occurs when the Functions runtime fails to initialize and cannot reach a healthy Running state. When this happens, you may see one or more of these symptoms:
- "Function host is not running" error in the Azure Portal
- Functions are not visible in the Functions blade
- Triggers stop firing — HTTP functions return 503, timer/queue functions are silent
- The portal shows Error state or no response on the host status endpoint
- Application Insights logs show repeated startup exceptions followed by restarts
- Log Stream shows a restart loop or no output at all
This issue can be frustrating, especially when a deployment appeared to succeed and your code works correctly on your local machine. In this blog, we will explore how the host starts up, what can go wrong, and — most importantly — how to systematically diagnose and resolve startup failures.
Understanding How the Host Starts Up
Before diving into troubleshooting, it is important to understand the startup sequence. The Functions host executes the following steps each time the runtime initializes:
Host Startup Sequence
ASP.NET Core Startup
→ Register WebHost services (DI, secrets, diagnostics, middleware)
→ WebJobsScriptHostService.StartAsync()
→ Check file system (run-from-package validation)
→ Build inner ScriptHost
→ ScriptHost.InitializeAsync()
→ PreInitialize (validate settings, file system)
→ Load function metadata (function.json / decorators)
→ Load extensions and bindings (extension bundles / NuGet)
→ Create function descriptors and register triggers
→ Start trigger listeners
→ State = Running ✓
Complete Source Code: Azure/azure-functions-host
If any step in this sequence fails, the host enters an Error state and attempts to restart with exponential backoff (starting at 1 second, up to 2 minutes between attempts). After repeated failures, the platform may report an application-level failure.
Host States
The Functions host can be in any of the following states:
| State | Meaning |
|---|---|
| Default | Host has not yet been created |
| Starting | Host is in the process of starting |
| Initialized | Functions indexed, listeners not yet running |
| Running | Fully running — triggers active, functions discoverable |
| Error | Host encountered an error — will attempt restart |
| Stopping | Host is shutting down |
| Stopped | Host is stopped |
| Offline | Host is offline (app_offline.htm is present) |
Only when the host reaches the Running state are functions visible in the portal and triggers active. The Error state triggers an automatic restart loop.
Key Settings That Affect Startup
| Setting | Purpose | Impact If Wrong |
|---|---|---|
| FUNCTIONS_EXTENSION_VERSION | Specifies the runtime version (e.g., ~4) | Host throws startup error if missing or invalid |
| FUNCTIONS_WORKER_RUNTIME | Specifies the language runtime (e.g., dotnet-isolated, node, python) | Host cannot load the correct worker process |
| AzureWebJobsStorage | Connection string for the required storage account | Host cannot store keys, coordinate triggers, or maintain state |
| WEBSITE_RUN_FROM_PACKAGE | Controls how deployment packages are loaded | Host shuts down if package is inaccessible or corrupted |
| WEBSITE_CONTENTAZUREFILECONNECTIONSTRING | Storage connection for content share (Consumption/Premium) | Host cannot access function code |
| WEBSITE_CONTENTSHARE | File share name for function content | Host cannot locate function files |
Startup Failure Categories
| Category | Examples | Typical Symptom |
|---|---|---|
| Configuration | Missing/invalid app settings, bad host.json | Host enters Error state immediately |
| Storage | AzureWebJobsStorage unreachable, expired SAS token, firewall | Host fails repeatedly, storage-related exceptions |
| Extensions/Bindings | Missing extension bundle, version mismatch, load failure | Host errors during extension loading phase |
| Deployment/Packaging | Corrupted zip, wrong package structure, missing files | Host starts but finds no functions, or fails to load assemblies |
| Code/Startup | DI exception, external startup error, assembly conflict | Host errors during initialization with code-specific exception |
| Runtime/Worker | Wrong worker runtime, language mismatch, gRPC failure | Host cannot establish worker channel |
| Networking | VNet blocks outbound, DNS failure, private endpoint misconfigured | Host cannot reach storage/dependencies at startup |
| Platform | Resource exhaustion, app_offline.htm, platform issue | Host enters Offline state or is killed before startup completes |
Common Causes and Solutions
1. Missing or Invalid FUNCTIONS_EXTENSION_VERSION
Symptoms:
- Host immediately fails to start
- Error message: "Invalid site extension configuration. Please update the App Setting 'FUNCTIONS_EXTENSION_VERSION' to a valid value (e.g. ~4)."
- Repeated restart loops in Application Insights
Why This Happens:
The FUNCTIONS_EXTENSION_VERSION app setting tells the platform which version of the Functions runtime to load. When your app runs as a hosted site extension (the normal case in Azure), this setting is validated as one of the first steps in ScriptHost.PreInitialize(). If it is missing, empty, or set to an unrecognized value, the host throws a HostInitializationException and cannot proceed.
How to Verify:
- Navigate to your Function App in the Azure Portal
- Go to Settings → Configuration → Application settings
- Look for FUNCTIONS_EXTENSION_VERSION
- Confirm it is set to a valid value: ~4 (recommended), ~3 (legacy), or a specific version
Solution:
- Set FUNCTIONS_EXTENSION_VERSION to ~4 (or the appropriate version for your app)
- If the setting was recently changed or removed, restore it
- Save and restart the Function App
Ref: FUNCTIONS_EXTENSION_VERSION
2. Missing or Mismatched FUNCTIONS_WORKER_RUNTIME
Symptoms:
- Error: "The 'FUNCTIONS_WORKER_RUNTIME' setting is required..." (diagnostic code AZFD0011)
- Error: "The 'FUNCTIONS_WORKER_RUNTIME' is set to 'X', which does not match the worker runtime metadata..." (diagnostic code AZFD0013)
- Host enters Error state after loading function metadata
Why This Happens:
The FUNCTIONS_WORKER_RUNTIME setting controls which language worker process the host launches (e.g., dotnet-isolated, node, python, java, powershell). During initialization, the host validates that this setting matches the actual function metadata discovered in your deployment. A mismatch — for example, deploying a Python app but having FUNCTIONS_WORKER_RUNTIME=node — results in a HostInitializationException.
How to Verify:
- Check the app setting value in Portal → Configuration
- Compare against your actual project type:
- C# in-process: dotnet
- C# isolated: dotnet-isolated
- Node.js: node
- Python: python
- Java: java
- PowerShell: powershell
Solution:
- Set FUNCTIONS_WORKER_RUNTIME to the correct value matching your function code
- If you recently migrated language models (e.g., in-process to isolated), update the setting accordingly
- Save and restart
3. Storage Account Connectivity Issues (AzureWebJobsStorage)
Symptoms:
- Host fails to start and cannot recover
- Errors related to Blob storage connectivity
- "Unable to get function keys" or secret management errors
- Health check returns Unhealthy
Why This Happens:
The Functions host requires a valid and reachable storage account for:
- Storing function keys and secrets
- Coordinating distributed triggers (e.g., timer triggers, queue listeners)
- Maintaining internal state and lock management
- Hosting the content share for Consumption and Premium plans
The host runs a background health check (WebJobsStorageHealthCheck) every 30 seconds that verifies Blob storage connectivity. If the storage account is unreachable — due to a wrong connection string, rotated keys, firewall restrictions, deleted account, or expired SAS token — the host will fail to initialize properly.
How to Verify:
Check your Application Settings for these storage-related values:
| Setting | Required For |
|---|---|
| AzureWebJobsStorage | All plans — primary storage connection |
| WEBSITE_CONTENTAZUREFILECONNECTIONSTRING | Consumption and Premium plans — content share |
| WEBSITE_CONTENTSHARE | Consumption and Premium plans — file share name |
You can also verify storage connectivity using the host status endpoint.
Solution:
- Verify the storage account exists — check the Azure Portal to confirm it has not been deleted or disabled
- Check for rotated keys — if storage keys were recently regenerated, update the connection string:
- Get the new connection string from the Storage Account → Access keys blade
- Update AzureWebJobsStorage in your Function App settings
- Check storage firewall rules:
- Go to Storage Account → Networking
- Ensure the Function App has access (public endpoint, service endpoint, or private endpoint depending on your architecture)
- For SAS-token-based connections — verify the token has not expired (diagnostic code AZFD0006)
- For VNet-integrated apps:
- Ensure service endpoints or private endpoints are configured for the storage account
- Verify DNS resolution works for *.blob.core.windows.net, *.queue.core.windows.net, *.table.core.windows.net, and *.file.core.windows.net
For detailed guidance, see Storage considerations for Azure Functions.
4. Invalid host.json Configuration
Symptoms:
- Error: "The host.json file is missing the required 'version' property." (diagnostic code AZFD0009)
- Error: "'X' is an invalid value for host.json 'version' property."
- JSON deserialization failures in logs
- Host enters a special HandlingConfigurationParsingError mode
Why This Happens:
The host.json file is parsed early in the startup sequence. If it is missing the required "version": "2.0" property, contains invalid JSON syntax, or has unrecognized configuration values, the host throws a HostConfigurationException. The host then restarts in a degraded mode that skips host.json parsing — the admin APIs remain functional for diagnostics, but functions will not load.
How to Verify:
Check your host.json in the deployment:
- Windows plans: Use Kudu → Debug Console → Navigate to site/wwwroot/host.json
- Linux/Flex Consumption: Use SSH or Azure CLI
Validate that the file:
- Is valid JSON (use a JSON validator)
- Contains the required "version": "2.0" property
- Does not have unrecognized or misspelled configuration keys
Minimal valid host.json:
{
"version": "2.0"
}
Typical host.json with extension bundle:
{
"version": "2.0",
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[4.*, 5.0.0)"
},
"logging": {
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"excludedTypes": "Request"
}
}
}
}
Solution:
- Fix any JSON syntax errors
- Ensure "version": "2.0" is present
- Remove or correct any unrecognized configuration keys
- Redeploy or edit the file directly via Kudu (Windows plans)
Ref: host.json
5. Extension Bundle or Binding Load Failures
Symptoms:
- Host fails to start with extension-related errors in logs
- Error: "Referenced bundle X of version Y does not meet the required minimum version..."
- Error: "One or more loaded extensions do not meet the minimum requirements..."
- Errors referencing ScriptStartUpErrorLoadingExtensionBundle or ScriptStartUpUnableToLoadExtension
- Works locally but fails in Azure
Why This Happens:
Azure Functions uses extension bundles to provide trigger and binding implementations (Service Bus, Event Hubs, Cosmos DB, etc.). During startup, the ScriptStartupTypeLocator loads extension assemblies from either the bundle path or the bin folder. If the bundle is missing, the version is incompatible, an assembly fails to load, or the type does not implement the expected interfaces, the host throws a HostInitializationException.
How to Verify:
- Check host.json for the extensionBundle configuration
- Verify the version range is compatible with your runtime version
- For compiled C# apps that don't use bundles, verify all required NuGet packages are present and compatible
Solution:
- Ensure extensionBundle is configured in host.json:
{
"version": "2.0",
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[4.*, 5.0.0)"
}
}
- Use the correct version range for your runtime:
- Functions v4: [4.*, 5.0.0)
- For compiled .NET apps using explicit extensions:
- Verify all extension NuGet packages are up to date
- Ensure extensions.json is present in the bin folder after build
- Check for assembly version conflicts in the build output
6. Deployment Package Issues (WEBSITE_RUN_FROM_PACKAGE)
Symptoms:
- Host shuts down immediately after startup
- Error: "Shutting down host due to presence of FAILED TO INITIALIZE RUN FROM PACKAGE.txt"
- Functions were visible before but disappeared after deployment
- "No functions found" in the portal
- Read-only file system errors in logs
Why This Happens:
When WEBSITE_RUN_FROM_PACKAGE is configured, the Functions host runs directly from a deployment package (ZIP file). During startup, the host checks the file system for failure markers. If the file FAILED TO INITIALIZE RUN FROM PACKAGE.txt is found, the host immediately shuts down the application — this is a fatal, non-recoverable error that requires redeployment.
Other common package issues include an inaccessible URL, an expired SAS token, files nested in a subfolder instead of the ZIP root, or a corrupted package.
WEBSITE_RUN_FROM_PACKAGE Values:
| Value | Behavior |
|---|---|
| 1 | Runs from a local package in d:\home\data\SitePackages (Windows) or /home/data/SitePackages (Linux) |
| <URL> | Runs from a remote package at the specified URL (required for Linux Consumption) |
| Not set | Traditional deployment — files extracted to wwwroot |
How to Verify:
- Check WEBSITE_RUN_FROM_PACKAGE in Application Settings
- If value is 1:
- Go to Kudu → Debug Console
- Navigate to d:\home\data\SitePackages
- Verify a .zip file exists and packagename.txt points to it
- If value is a URL:
- Try accessing the URL directly — it should download the ZIP
- Check for expired SAS tokens (403 response) or missing blobs (404 response)
- Verify package contents:
- Download and extract the ZIP
- Confirm host.json and function files are at the root level, not in a nested subfolder
Common Issues:
| Problem | Symptom | Fix |
|---|---|---|
| Expired SAS token | Package URL returns 403 | Generate new SAS with longer expiry |
| Package URL not accessible | Package URL returns 404 | Verify blob exists and URL is correct |
| Wrong package structure | Files in subfolder | Ensure files are at ZIP root |
| Corrupted package | Host startup errors | Redeploy with a fresh package |
| Storage firewall blocking | Timeout errors | Allow Function App access to storage |
Solution:
- Redeploy your Function App using your preferred deployment method
- If using URL-based packages, regenerate the SAS token or use managed identity-based access
- If the failure marker file exists, redeployment will overwrite it
- Restart the Function App after fixing:
7. Code-Level Startup Exceptions (DI and External Startup)
Symptoms:
- Host Error state with application-specific exception in logs
- Error: "Error configuring services in an external startup class" (diagnostic code AZFD0005)
- Dependency injection failures (InvalidOperationException, TypeLoadException)
- Errors in Program.cs or Startup.cs of your application
- Assembly binding or version conflict exceptions
Why This Happens:
For isolated worker (.NET) apps, your Program.cs runs custom startup code before the worker connects to the host. For in-process (.NET) apps, custom IWebJobsStartup implementations run during host initialization. If this code throws — for example, a missing dependency, a failed external service connection, or a type load error — the host catches the exception and enters an Error state with a HostInitializationException.
How to Verify:
- Check Application Insights Exceptions table for the specific exception type and stack trace
- Look for errors containing AZFD0005 (external startup error)
- Review your Program.cs / Startup.cs for:
- Service registrations that depend on external resources (databases, APIs, Key Vault)
- Missing NuGet packages or assembly version mismatches
- Configuration values that may differ between local and Azure environments
Solution:
- Fix the exception identified in logs — the stack trace usually points directly to the failing code
- Ensure all required environment variables and connection strings are set in Application Settings
- For assembly conflicts, check that all NuGet package versions are compatible and aligned
- Consider making external-service connections resilient by deferring initialization or adding retry logic
- Test startup locally with the same environment variables as Azure
8. Language Worker Channel Failure
Symptoms:
- Error: "Failed to start Language Worker Channel for language: {runtime}"
- Error: "Failed to start Rpc Server. Check if your app is hitting connection limits."
- Host starts but cannot communicate with the language worker process
- Timeout errors during worker initialization
Why This Happens:
For out-of-process languages (Node.js, Python, Java, PowerShell, .NET Isolated), the Functions host communicates with a separate worker process over gRPC. If the host cannot start the gRPC server, or the worker process fails to launch or connect, the host throws a HostInitializationException.
Common causes include:
- Port conflicts
- Missing language runtime or incorrect version
- Worker process crashes on startup
- Resource exhaustion (memory, file handles)
How to Verify:
- Check Application Insights for gRPC or worker-related errors
- Verify the correct language runtime version is installed:
- For Node.js: Check WEBSITE_NODE_DEFAULT_VERSION
- For Python: Check the Python version in Configuration → General settings
- For Java: Check FUNCTIONS_WORKER_JAVA_LOAD_APP_LIBS and Java version
- For .NET Isolated: Check target framework in the deployed assemblies
- Check if the Function App is hitting plan resource limits
Solution:
- Ensure the correct language runtime version is configured
- For Linux Consumption, verify the correct runtime stack is selected in Configuration → General settings
- If resource limits are suspected, consider scaling up to a higher plan tier
- Restart the Function App to clear temporary port or resource issues
9. Networking Blocking Required Dependencies
Symptoms:
- Host fails to start in VNet-integrated apps
- Timeout errors connecting to storage or other Azure services
- Works without VNet integration, fails with it enabled
- DNS resolution failures in logs
- NSG or firewall-related errors
Why This Happens:
During startup, the Functions host must reach several external endpoints:
- Azure Storage (Blob, Queue, Table, File) — for keys, triggers, and state
- Extension bundle CDN — to download extension bundles (first run or cold start)
- Azure Key Vault — if Key Vault references are used in app settings
- Application Insights — for telemetry (non-blocking, but can delay if timing out)
If VNet integration, NSG rules, forced tunneling, or a firewall blocks these outbound connections, the host cannot complete startup.
How to Verify:
- Check if the Function App has VNet integration enabled (Networking blade)
- Review NSG rules on the integrated subnet — ensure outbound to Azure services is allowed
- For apps with forced tunneling, verify the firewall/NVA allows required endpoints
- Check DNS resolution for storage endpoints from within the VNet context
Solution:
- Add NSG rules or firewall rules to allow outbound traffic to the required endpoints
- Configure service endpoints or private endpoints for storage on the integrated subnet
- Ensure DNS resolution works for all required endpoints
- For private DNS zones, ensure proper zone links and records exist for storage
See Azure Functions networking options for detailed configuration guidance.
10. app_offline.htm Causing Offline State
Symptoms:
- Host status shows Offline
- All requests return an offline page
- Portal shows the app is running but functions return errors
Why This Happens:
If a file named app_offline.htm exists in the function app's script root directory, the host detects it during startup and enters the Offline state. Some deployment tools create this file during deployment to gracefully take the app offline, and it should be removed automatically when deployment completes. If it is left behind — for example, due to a failed deployment — the host remains offline.
How to Verify:
- Windows plans: Go to Kudu → Debug Console → Navigate to site/wwwroot and look for app_offline.htm
- Linux: Use SSH or Azure CLI to check for the file
Solution:
- Delete app_offline.htm from the app's root directory
- The host will automatically detect the deletion and restart into a normal state
- If the file reappears after deletion, investigate your deployment pipeline — it may be creating the file but failing to remove it
Using Diagnose and Solve Problems
The Azure Portal provides built-in diagnostics specifically designed for Functions host startup issues.
How to Access:
- Navigate to your Function App in the Azure Portal
- Select Diagnose and solve problems from the left menu
- Search for relevant detectors:
| Detector | What It Checks |
|---|---|
| Function App Down or Reporting Errors | Overall app health, host status, crash history |
| Function App Startup Issue | Specific startup failure analysis, configuration validation |
| Functions Configurations Check | host.json and app settings validation |
| Functions Deployment | Recent deployment status and potential issues |
| Network Troubleshooter | VNet, private endpoint, and access restriction diagnostics |
These detectors run automated checks against your Function App and provide targeted recommendations.
The detectors often identify the root cause faster than manual investigation.
Verifying Host Status via REST API
You can check the host status programmatically to determine the current state and any reported errors.
Get Host Status:
curl "https://<app>.azurewebsites.net/admin/host/status?code=<master-key>"</master-key></app>
See Admin API for details.
The state field is the single most important indicator:
| State | Action |
|---|---|
| Running | Host is healthy — investigate function-level issues |
| Error | Host startup failed — check the errors array for root cause |
| Offline | app_offline.htm present — check deployment state |
| No response / timeout | Host cannot serve requests — check platform health and networking |
List Functions (verify discovery):
curl "https://<app>.azurewebsites.net/admin/functions?code=<master-key>"</master-key></app>
Quick Troubleshooting Checklist
Use this checklist to systematically diagnose host startup issues:
- [ ] Host status: Check /admin/host/status — is the state Running, Error, or Offline?
- [ ] First error: Check Application Insights Exceptions or Log Stream — what is the first exception after the latest restart?
- [ ] FUNCTIONS_EXTENSION_VERSION: Is it set to a valid value (e.g., ~4)?
- [ ] FUNCTIONS_WORKER_RUNTIME: Is it set correctly and does it match the deployed code?
- [ ] AzureWebJobsStorage: Is the connection string valid? Is the storage account reachable from the app's network context?
- [ ] host.json: Does it exist, contain valid JSON, and include "version": "2.0"?
- [ ] Extension bundle: Is extensionBundle configured with a compatible version range?
- [ ] Package deployment: If using WEBSITE_RUN_FROM_PACKAGE, is the package accessible and correctly structured?
- [ ] Startup code: For .NET apps, does Program.cs / startup code throw during DI registration?
- [ ] Networking: If VNet-integrated, can the app reach storage, Key Vault, and extension CDN endpoints?
- [ ] Offline file: Is app_offline.htm present in the root directory?
- [ ] Diagnose and Solve: Have you run the Function App Startup Issue detector in the Azure Portal?
Diagnostic Event Codes Reference
When reviewing logs, look for these Azure Functions diagnostic codes that are related to startup failures:
| Code | Name | Meaning |
|---|---|---|
| AZFD0005 | External Startup Error | Error in a custom IWebJobsStartup class |
| AZFD0006 | SAS Token Expiring | AzureWebJobsStorage SAS token is expiring or expired |
| AZFD0009 | Unable to Parse host.json | host.json file is missing or has invalid content |
| AZFD0011 | Missing FUNCTIONS_WORKER_RUNTIME | The required worker runtime setting is not configured |
| AZFD0013 | Worker Runtime Mismatch | FUNCTIONS_WORKER_RUNTIME does not match deployed function metadata |
These codes appear in Application Insights traces and diagnostic event logs.
Conclusion
Azure Functions host startup failures can be caused by a wide range of issues — from a simple missing app setting to complex networking misconfigurations. The key to efficient troubleshooting is a systematic approach:
Key Takeaways:
- Always check host status first — the /admin/host/status endpoint tells you the current state and any errors
- Find the first error, not the cascade — look for the initial exception after the most recent restart
- Validate configuration — FUNCTIONS_EXTENSION_VERSION, FUNCTIONS_WORKER_RUNTIME, and AzureWebJobsStorage are the three settings that cause the most startup failures
- Check host.json — a missing version property or invalid JSON is a common and easily fixable cause
- Verify deployment artifacts — ensure your package is complete, correctly structured, and accessible
- Use built-in diagnostics — the Diagnose and Solve Problems detectors are purpose-built for these issues
- Apply one fix at a time — change one setting, restart, and recheck. Avoid multiple simultaneous changes that obscure which fix resolved the issue
If you continue to experience startup issues after following these steps, consider opening a support ticket with Microsoft Azure Support, providing:
- Function App name and resource group
- Timestamp of when the issue started
- Host status endpoint response (copy the full JSON)
- The first exception from Application Insights or Log Stream
- Recent deployment or configuration changes
- Networking configuration details (if VNet-integrated)
References
- Azure Functions host.json reference
- Azure Functions app settings reference
- Azure Functions deployment technologies
- Storage considerations for Azure Functions
- Azure Functions networking options
- Azure Functions diagnostics
- Azure Functions Admin API (host status)
- Run your functions from a package file
- Troubleshoot Azure Functions
Have questions or feedback? Leave a comment below.