Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
Hi @Vu Chau ,
When an Azure Function App shows “Host initialization error” after deployment (but works locally with func start), it’s usually pointing to a runtime startup/config/environment problem rather than your deployment package alone.
Here are the most relevant, practical checks and debugging steps based on the provided documentation.
- Confirm the Function host is actually starting in Azure
- Open the Azure Functions homepage in the portal. If the Functions Host is running, you’ll see it there (unless the homepage was disabled).
- Verify the correct Azure Functions runtime version
- Make sure your Function App is targeting the right Azure Functions Runtime version for your app.
- If it’s mismatched, the host can fail during startup.
- Storage account settings (critical for host startup)
- If the Function App is on the Consumption plan, the host depends on the storage account configuration.
- Verify storage account settings and recovery-related requirements (for example, ensure the storage settings aren’t deleted/misconfigured).
- Review the logs for the real startup exception
- Check Application Insights exceptions if enabled.
- The guidance suggests querying the exceptions table to see the underlying failure.
- If you don’t have Application Insights or want more details, you can also use Kudu/SCM logs:
- Check Kudu SCM event log at:
D:\Logfiles\Eventlog,xml
- Check Kudu SCM event log at:
A very useful “quick visibility” step is to turn on extra host file logging temporarily:
- In Host.json, set
fileLoggingModetoalwaysto capture more debug output during startup. - Those logs will appear in Kudu at:
-
D:\home\LogFiles\Application\Functions - For production, the recommendation is to revert to the default
debugOnlyafter troubleshooting.
-
From the “Application Issues post deployment” guidance, runtime failures after deployment often come from things like:
- Network connectivity to a secure storage account (host can’t start)
- Function App configuration issues (incorrect runtime/language version, trigger connection strings, key vault settings, etc.)
- External dependencies (DB/messaging) causing timeouts during startup
- Code assumptions about paths that exist locally but not in Azure
- Azure Functions runtime sandbox restrictions
Also try restarting the Function App (simple but effective)
- Manually restart the Functions app to see if startup succeeds.
Use Azure Functions Diagnostics
- Run the Azure Functions Diagnostics tool to quickly diagnose common host/app issues.
If you recently edited host.json/function.json or changed application settings, the platform restarts the host to apply changes.
- Modifying
host.jsonrestarts the host and Adding/removing Application Settings restarts the main process - Application Insights can be used to confirm whether restarts happened, via queries that look for:
-
Host configuration has changed. Signaling restart- and “File change … detected”
-
- Activity logs can also show
Update web sites configoperations during the timeframe.
Hope this helps!
If the resolution was helpful, kindly take a moment to click on and click on Yes for was this answer helpful. And, if you have any further query do let us know.