# Azure Functions Templates Dynamic template selection for Azure Functions projects. ## Prerequisites: Check MCP Availability Before proceeding, verify Azure MCP Server and Functions tools are available: ``` functions_template_get(language: "python") ``` | Result | Action | |--------|--------| | ✅ Returns template list | Use **Primary Path: MCP Tools** below | | ❌ Tool not found / Error | Jump to **[Fallback (MCP Unavailable)](#fallback-mcp-unavailable)** | --- ## Primary Path: MCP Tools **Use Azure MCP tools** — they provide complete, up-to-date AZD templates with IaC, RBAC, and managed identity. ### Step 1: Discover Templates ``` functions_template_get(language: "") ``` Returns template list with metadata: - `templateName` — pass to generate call - `description` — use for selection (describes trigger, bindings, security features) - `resource` — filter by trigger type (http, cosmos, timer, eventhub, blob, sql, mcp, ai) - `infrastructure` — prefer `bicep` (default), use `terraform` if user requests ### Step 2: Select Template Use the intent→resource mapping in [selection.md](selection.md) to map user intent to a `resource` filter value. > **Default behavior:** When user intent cannot be determined or no trigger type is known, use `http` as the default. **Single-template optimization:** If description mentions BOTH trigger AND binding user needs, fetch that one template only. **IaC selection:** - Default: `infrastructure: "bicep"` - If user says "terraform": `infrastructure: "terraform"` ### Step 3: Generate Project ``` functions_template_get( language: "", template: "" ) ``` ### Step 4: Write All Files > Write files directly from the MCP tool output — CLI scaffolding tools produce incomplete projects missing IaC, RBAC, and managed identity configuration. NEVER hand-write Bicep/Terraform and use `azd init -t