Skip to content

01 - Run Locally (Flex Consumption)

Run the Function App locally with Azure Functions Core Tools so you can validate routes, logging, and trigger behavior before your first FC1 deployment.

Prerequisites

Tool Minimum version Purpose
Python 3.11 Local runtime and dependencies
Azure Functions Core Tools 4.x Local Functions host
Azure CLI 2.60+ Azure authentication and resource commands
Azurite Latest Local Azure Storage emulator

What You'll Build

You will run the Python reference Function App locally with Azurite, validate HTTP routes, and verify Flex Consumption-specific behavior before cloud deployment.

Infrastructure Context

Plan: Flex Consumption (FC1) — Network: Full private network (VNet + Private Endpoints)

This tutorial runs locally — no Azure resources are created.

flowchart LR
    DEV[Local Machine] --> HOST[Functions Host :7071]
    HOST --> AZURITE[Azurite Local Storage]
flowchart LR
    Dev[Developer Shell] --> Venv[Python venv + dependencies]
    Dev --> Azurite[Azurite local storage]
    Venv --> Host[Functions host :7071]
    Host --> Health["/api/health"]
    Host --> Info["/api/info"]

Steps

Step 1: Set Standard Variables

Use one variable set throughout this tutorial track.

export BASE_NAME="flexdemo"
export RG="rg-flexdemo"
export APP_NAME="flexdemo-func"
export PLAN_NAME="flexdemo-plan"
export STORAGE_NAME="flexdemostorage"
export APPINSIGHTS_NAME="flexdemo-insights"
export LOCATION="koreacentral"

Expected output:


Step 2: Create and Activate a Virtual Environment

python3 --version
virtualenv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install --requirement apps/python/requirements.txt

Expected output:

Python 3.11.x
Successfully installed ...

Step 3: Create Local Settings

cp apps/python/local.settings.json.example apps/python/local.settings.json

Update apps/python/local.settings.json to include local development values:

{
  "IsEncrypted": false,
  "Values": {
    "FUNCTIONS_WORKER_RUNTIME": "python",
    "AzureWebJobsStorage": "UseDevelopmentStorage=true",
    "AZURE_FUNCTIONS_ENVIRONMENT": "Development"
  }
}

Expected output:


Step 4: Start Azurite

Flex Consumption in Azure uses identity-based host storage, but local development still uses Azurite with UseDevelopmentStorage=true.

azurite --silent --location /tmp/azurite --debug /tmp/azurite/debug.log

Expected output:

Azurite Blob service is starting at http://127.0.0.1:10000
Azurite Queue service is starting at http://127.0.0.1:10001
Azurite Table service is starting at http://127.0.0.1:10002

Step 5: Start the Functions Host

In another terminal:

cd apps/python
func host start

Expected output:

Azure Functions Core Tools
Core Tools Version:       4.x
Function Runtime Version: 4.x

Functions:

        health: [GET] http://localhost:7071/api/health
        info: [GET] http://localhost:7071/api/info

Step 6: Verify Endpoints

curl --request GET "http://localhost:7071/api/health"
curl --request GET "http://localhost:7071/api/info"

Expected output:

{"status":"healthy","timestamp":"2026-01-01T00:00:00Z","version":"1.0.0"}
{"name":"azure-functions-field-guide","version":"1.0.0","python":"3.11.x","environment":"Development","telemetryMode":"basic","functionApp":"local","invocationId":"local"}

Step 7: Validate Flex-Specific Constraints Early

  • Flex Consumption is Linux-only.
  • Blob trigger production path is Event Grid based; polling blob trigger is not supported for Flex.
  • Scale behavior supports scale-to-zero and up to 1000 instances.
  • Instance memory options are 512 MB, 2048 MB, or 4096 MB.
  • Function timeout defaults to 30 minutes; max is unlimited.
  • Deployment slots are not supported.

Verification

  • func host start lists at least health and info routes on http://localhost:7071.
  • curl --request GET "http://localhost:7071/api/health" returns HTTP 200 with a JSON health payload.
  • curl --request GET "http://localhost:7071/api/info" returns HTTP 200 with runtime/config metadata from apps/python/blueprints/info.py.

Next Steps

Next: 02 - First Deploy

See Also

Sources