Templates¶
The CLI supports the most common Azure Functions triggers. Each trigger-based template follows the Blueprint pattern, automatically generating the trigger, a corresponding service, and a test file. The LangGraph template uses a different structure based on LangGraphApp. To preview the exact files each template produces, see Generated Output.
Template Overview¶
| Template | CLI Command | Primary Use Case |
|---|---|---|
| HTTP | afs new <name> |
APIs, webhooks, synchronous requests. |
| Timer | afs worker timer <name> |
Scheduled tasks, clean-up jobs, reports. |
| Queue | afs worker queue <name> |
Async message processing from Azure Storage. |
| Blob | afs worker blob <name> |
File processing, image resizing, data ingestion. |
| Service Bus | afs worker servicebus <name> |
Enterprise messaging with topics or queues. |
| Event Hub | afs worker eventhub <name> |
High-throughput event stream ingestion. |
| CosmosDB | afs advanced new --template cosmosdb --preset standard <name> |
Change feed processing from Cosmos DB containers. |
| Durable | afs advanced new --template durable --preset standard <name> |
Orchestrated workflows with activities and fan-out. |
| AI | afs advanced new --template ai --preset standard <name> |
Azure OpenAI chat completion endpoints. |
| LangGraph | afs ai agent <name> |
LangGraph agent deployment on Azure Functions. |
HTTP Template¶
The default template for building RESTful APIs.
- Generates:
app/functions/http.py,app/services/hello_service.py,tests/test_http.py. - Key points: Configured with a default
helloroute and JSON response handling.
Timer Template¶
Triggers functions on a schedule using CRON expressions.
- Generates:
app/functions/timer.py,app/services/maintenance_service.py,tests/test_timer.py. - Key points: Default schedule is set to
0 */5 * * * *(every 5 minutes) inhost.jsonor the trigger decorator.
Queue Template¶
Reacts to messages added to an Azure Storage Queue.
- Generates:
app/functions/queue.py,app/services/queue_service.py,tests/test_queue.py. - Key points: Requires
AzureWebJobsStorageconnection string.
Local Development
Use Azurite to simulate Azure Storage Queues locally.
Blob Template¶
Triggers when a blob is uploaded or updated in a storage container.
- Generates:
app/functions/blob.py,app/services/blob_service.py,tests/test_blob.py. - Key points: Default container path is
samples-workitems/{name}.
Service Bus Template¶
Handles high-throughput enterprise messages from Service Bus queues or topics.
- Generates:
app/functions/servicebus.py,app/services/servicebus_service.py,tests/test_servicebus.py. - Key points: Uses a
ServiceBusConnectionplaceholder in your settings.
Event Hub Template¶
Ingests high-throughput event streams from Azure Event Hubs.
- Generates:
app/functions/eventhub.py,app/services/eventhub_service.py,tests/test_eventhub.py. - Key points: Uses an
EventHubConnectionplaceholder. Default event hub name ismy-event-hub.
CosmosDB Template¶
Reacts to document changes via the Cosmos DB change feed.
- Generates:
app/functions/cosmosdb.py,app/services/cosmosdb_service.py,tests/test_cosmosdb.py. - Key points: Uses
cosmos_db_trigger_v3binding. RequiresCosmosDBConnectionand a lease container for tracking.
Local Development
Use the CosmosDB Emulator for local change feed testing.
Durable Template¶
Builds orchestrated workflows with an HTTP starter, orchestrator, and activity functions.
- Generates:
app/functions/durable.py,app/services/durable_service.py,tests/test_durable.py. - Key points: Uses
azure.functions.durable_functions. Requires Azurite for state management.
AI Template¶
Creates an HTTP endpoint backed by Azure OpenAI for chat completions.
- Generates:
app/functions/ai.py,app/services/ai_service.py,tests/test_ai.py. - Key points: Requires
AZURE_OPENAI_ENDPOINT,AZURE_OPENAI_API_KEY, andAZURE_OPENAI_DEPLOYMENTsettings.
LangGraph Template¶
Deploys a LangGraph agent as an Azure Functions app using azure-functions-langgraph.
- Generates:
app/graphs/echo_agent.py,function_app.py,tests/test_echo_agent.py. - Key points: Uses
LangGraphAppto register graphs. Default scaffold includes an echo agent.
What's Next?¶
Enhance your project with Features and Presets like OpenAPI or Pydantic validation.
Want to see exactly what each template produces? Check the Generated Output reference for per-template project trees and function_app.py / host.json snippets.