Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Prepare Azure environments for new workloads—subscriptions, networking, identity, and landing zones
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/services/functions/templates/selection.md
1# Template Selection Guide23Map user intent to MCP template `resource` filter.45> **NEVER hardcode template names** — names can change. Always use `functions_template_get(language)` to discover available templates, then filter by `resource` field.67## Intent → Resource Mapping89| User Says | Code Indicators (existing projects) | Resource Filter | Recipe Reference |10|-----------|-------------------------------------|-----------------|------------------|11| "HTTP", "REST", "API", "webhook" | `HttpTrigger`, `@app.route`, `req: HttpRequest` | `http` | — |12| "timer", "schedule", "cron", "periodic" | `TimerTrigger`, `@app.schedule`, `TimerInfo` | `timer` | [recipes/timer/README.md](recipes/timer/README.md) |13| "Cosmos", "CosmosDB", "document DB" | `CosmosDBTrigger`, `@app.cosmos_db`, `cosmos_db_input` | `cosmos` | [recipes/cosmosdb/README.md](recipes/cosmosdb/README.md) |14| "Event Hub", "streaming", "events" | `EventHubTrigger`, `@app.event_hub`, `event_hub_output` | `eventhub` | [recipes/eventhubs/README.md](recipes/eventhubs/README.md) |15| "Service Bus", "queue", "message" | `ServiceBusTrigger`, `@app.service_bus_queue` | `servicebus` | [recipes/servicebus/README.md](recipes/servicebus/README.md) |16| "blob", "file", "storage trigger" | `BlobTrigger`, `@app.blob`, `blob_input`, `blob_output` | `blob` | [recipes/blob-eventgrid/README.md](recipes/blob-eventgrid/README.md) |17| "SQL", "database trigger" | `SqlTrigger`, `@app.sql`, `sql_input`, `SqlOutput` | `sql` | [recipes/sql/README.md](recipes/sql/README.md) |18| "MCP", "MCP server", "tools" | `McpToolTrigger`, `@app.mcp_tool`, `mcp` in project | `mcp` | [recipes/mcp/README.md](recipes/mcp/README.md) |19| "durable", "workflow", "orchestration" | `DurableOrchestrationTrigger`, `orchestrator`, `durable_functions` | `durable` | [recipes/durable/README.md](recipes/durable/README.md) |20| "AI", "agent", "chatbot", "OpenAI" | `openai`, `AzureOpenAI`, `langchain`, `semantic_kernel` | `http` | Scan description for "AI", "agent", "Copilot SDK" |21| **No specific trigger / intent unclear** | — | `http` (default) | — |2223## Selection Algorithm2425```261. DISCOVER: functions_template_get(language) → template list272. DETECT (existing code): Scan for code indicators above → map to resource283. MATCH (new projects): Scan template descriptions for user intent294. FILTER: resource == mapped_resource AND infrastructure == user_iac_choice305. PREFER: AZD-enabled (infrastructure: "bicep" or "terraform")316. SELECT: Template whose description best matches user intent327. DEFAULT: If intent unclear or no trigger specified → use `http`33```3435## Output: Working Function App3637MCP templates return **complete, deployable projects** — each array entry has `{ path, content }`:3839| Array | Contents | Action |40|-------|----------|--------|41| `functionFiles[]` | Function source code (triggers, bindings, business logic), infra and other files | Create directories from `path`, write `content` to each file |42| `projectFiles[]` | settings.json, host.json, dependencies files | Create directories from `path`, write `content` to each file |4344> Write files from the array output above. NEVER hand-write Bicep/Terraform and use `azd init -t <template>`/`func init`/`func new` as fallback when composing multiple recipes and required templates are not found.4546For deployment steps, see [README.md](README.md#step-5-deploy).4748## Default Behavior4950**When user intent is ambiguous or no specific trigger is mentioned**, default to HTTP:5152- User says "create a function" with no trigger → HTTP53- User describes business logic without specifying trigger → HTTP54- Intent cannot be determined from context → HTTP5556HTTP is the safest default because it's the most common trigger type and provides a simple request/response pattern that works for most use cases.5758## IaC Selection5960| User Says | Filter By |61|-----------|-----------|62| Nothing specified | `infrastructure: "bicep"` (default) |63| "terraform", "use terraform" | `infrastructure: "terraform"` |64| "bicep", "use bicep" | `infrastructure: "bicep"` |6566## Non-AZD Fallback6768If specific trigger/binding has no AZD template:69701. Use non-AZD template for **function code** only712. Find related AZD template as **IaC reference**:7273| Non-AZD Resource | Related AZD Reference |74|-----------------|----------------------|75| RabbitMQ, Kafka | EventHub AZD |76| SendGrid, Twilio, Webhook | HTTP AZD |77| IoT Hub | EventHub AZD |78