Introduction

Azure Function app deployment fails when runtime version mismatch or zip deploy invalid. This guide provides step-by-step diagnosis and resolution.

Symptoms

Typical error output:

bash
Error: Deployment failed
Function runtime version mismatch: expected '4' but found '3'
Zip deployment package size exceeds limit of 100MB

Common Causes

  1. 1.Runtime version mismatch between local and Azure
  2. 2.Deployment package exceeds size limit
  3. 3.Missing app settings or connection strings
  4. 4.Incompatible extension bundle version

Step-by-Step Fix

Step 1: Check Current State

bash
az functionapp show --resource-group MyRG --name MyFunc --query siteConfig.linuxFxVersion
az functionapp deployment source show --resource-group MyRG --name MyFunc
func azure functionapp publish MyFunc --verbose

Step 2: Identify Root Cause

bash
az monitor activity-log list --resource-group MyRG --status Failed

Step 3: Apply Primary Fix

```bash # Update function app runtime version az functionapp config set --resource-group MyRG --name MyFunc --linux-fx-version "PYTHON|3.11"

# Deploy with zip package (limit 100MB) func azure functionapp publish MyFunc --build remote ```

Step 4: Apply Alternative Fix

```bash # Alternative fix: Check configuration az resource show --resource-group MyRG --name MyResource -o yaml

# Update specific properties az resource update --resource-group MyRG --name MyResource --set properties.<key>=<value>

# Verify the fix az resource show --resource-group MyRG --name MyResource --query properties.<key> ```

Step 5: Verify the Fix

bash
az functionapp show --resource-group MyRG --name MyFunc --query state
func azure functionapp list-functions MyFunc

Common Pitfalls

  • Forgetting to check quota limits before resize operations
  • Not waiting for async operations to complete before next step
  • Missing RBAC permissions for Azure resource operations
  • Confusing subscription-level and resource-level quotas

Best Practices

  • Always check quota before provisioning new resources
  • Use Azure Resource Health for monitoring
  • Implement proper error handling in Azure CLI scripts
  • Enable diagnostic settings for all critical resources
  • Azure Subscription Quota Exceeded
  • Azure Resource Deployment Failed
  • Azure Network Connectivity Issues
  • Azure RBAC Permission Denied