Troubleshooting Azure Function App Publish Failures: 'Value cannot be null. Parameter 'input'' on Windows using PowerShell in Premium or Consumption Plan
Use this when publishing a Windows PowerShell Azure Function fails with Value cannot be null. Parameter 'input'.
Quick Read
- Symptom: Use this when publishing a Windows PowerShell Azure Function fails with Value cannot be null. Parameter 'input'.
- Check first: Confirm Functions Core Tools version, PowerShell runtime version, and Function App runtime stack.
- Risk: Security-sensitive
Symptoms
Azure Function App fails to publish with the error message 'Value cannot be null. Parameter 'input'' when using PowerShell.
Environment
Azure Function App on Windows, using PowerShell, deployed in Premium or Consumption Plan.
Most Likely Causes
This error typically occurs due to missing or incorrectly configured parameters in the Azure Function App settings or during the publishing process.
What to Check First
- Confirm Functions Core Tools version, PowerShell runtime version, and Function App runtime stack.
- List app settings and identify missing storage, worker runtime, or deployment settings.
- Capture publish output with timestamps before retrying.
Fix Steps
- Verify Azure Function App Configuration
Check the configuration settings of your Azure Function App to ensure all required parameters are set correctly.
Safe to run: read-only
az functionapp show --name <FunctionAppName> --resource-group <ResourceGroupName>
- Check for Missing Application Settings
Ensure that all necessary application settings are defined in the Azure portal.
Safe to run: read-only
az functionapp config appsettings list --name <FunctionAppName> --resource-group <ResourceGroupName>
- Validate Function Code
Examine the function code for any null references or uninitialized variables that may lead to this error.
Example pattern only. Adjust for your environment before running.
Open the function code in your preferred editor and check for any potential null variables.
- Inspect Publish Profile
Review the publish profile for the Function App to ensure it is correctly configured.
Safe to run: read-only
az functionapp deployment list --name <FunctionAppName> --resource-group <ResourceGroupName>
- Update Azure CLI and PowerShell Modules
Ensure that you are using the latest version of Azure CLI and PowerShell modules to avoid compatibility issues.
Changes system state: review before running
az upgrade Update-Module -Name Az -Force
- Retry Publishing the Function App
Attempt to publish the Function App again after verifying all configurations and settings.
Example pattern only. Adjust for your environment before running.
func azure functionapp publish <FunctionAppName> --resource-group <ResourceGroupName>
Validation
- `az functionapp config appsettings list` shows required runtime and storage settings.
- `func azure functionapp publish <FunctionAppName>` completes and reports uploaded functions.
- Function App logs show the host starting and the expected functions loaded.
Logs to Check
- Functions Core Tools publish output.
- Function App Log stream.
- Application Insights traces if enabled.
- Azure Activity Log for app setting and deployment changes.
Rollback and Escalation
- Restore previous app settings from a pre-change export if a setting change breaks startup.
- Redeploy the last known-good function package if the new publish fails.
- Avoid running `az upgrade` or module updates on a shared build worker without a rollback image or pinned tool version.
Edge Cases
- If the error persists, consider checking the Azure Activity Log for additional error details.
- Review the network configuration and ensure there are no restrictions that could affect the publishing process.
Notes from the Field
- The `input` error is often a packaging/configuration symptom. Confirm runtime and app settings before assuming the function code is bad.
- Publishing is state-changing. Capture current app settings and deployment state before retrying from a developer workstation.