Azure Functions
Triggers and bindings · HTTP, timer and queue triggers · Python model · hosting plans · deployment and slots
By the tools4free.dev team · Last reviewed November 13, 2026
Practice questions for this topic →
Triggers and bindings
- A trigger defines how a function is invoked. A function must have exactly one trigger.
- Bindings are optional. A function can have several input and output bindings. An input binding passes data in. An output binding writes data out.
- The trigger is a special type of input binding. Bindings let you avoid hardcoding access to other services. You can also create an Azure SDK client in your code instead.
- Register all binding extensions except HTTP and timer.
- In the Python v2 model you declare triggers and bindings with decorators, for example
@app.queue_output(arg_name="msg", queue_name="outqueue", connection="AzureWebJobsStorage").
| Type | Trigger | Input | Output |
|---|---|---|---|
| Blob Storage | Yes | Yes | Yes |
| Azure Cosmos DB | Yes | Yes | Yes |
| Event Grid | Yes | - | Yes |
| HTTP and webhooks | Yes | - | Yes |
| Queue Storage | Yes | - | Yes |
| Service Bus | Yes | - | Yes |
| Timer | Yes | - | - |
| Table Storage | - | Yes | Yes |
| SendGrid | - | - | Yes |
The Azure Cosmos DB trigger reads the change feed. It sees inserts and updates. The change feed doesn't include updates from deletions.
HTTP and timer triggers
| authLevel | What the caller needs |
|---|---|
anonymous | No access key is required. |
function | A function-specific key is required. This is the default when no level is set. |
admin | The master key is required. |
- A key goes in the
codequery string variable or in thex-functions-keyHTTP header. A function key or any host key works. - Authorization is disabled when you run locally. After you publish to Azure, the
authLevelsetting is enforced. - An HTTP triggered function can take at most 230 seconds to respond, whatever the plan timeout is. After that the Azure Load Balancer times out with an HTTP 502 and the function keeps running.
- Timer schedules use NCRONTAB:
{second} {minute} {hour} {day} {month} {day-of-week}. Example:0 30 9 * * 1-5is 9:30 AM every weekday. The default time zone is UTC. Set theWEBSITE_TIME_ZONEapp setting to change it. - When a timer-triggered app scales out, only one instance of the timer function runs. Instances coordinate through blob storage on the host storage connection.
isPastDueis true when the invocation is later than scheduled. A TimeSpan schedule works only on an App Service plan. The page saysrunOnStartupshould rarely if ever be set to true, especially in production.
Queue and Service Bus triggers
- A failing queue trigger is retried up to five times for a message, including the first try. Then a message goes to a queue named
<originalqueuename>-poison. - The default visibility timeout is zero, so a failed message reappears immediately. Use
visibilityTimeoutin host.json to delay reprocessing. - If the host crashes during execution, the message reappears after the storage service default of 10 minutes.
- For a Service Bus trigger,
AutoCompleteMessagestrue completes the message after a successful invocation. Set it to false when your code settles the message.
Python model and connections
| Python model | How you define triggers and bindings | Use |
|---|---|---|
| 2.x | Decorators in function_app.py or a blueprint file | Recommended for new apps |
| 1.x | A separate function.json per function | Legacy apps |
- Blueprints define functions in separate Python files. You register them with
app.register_functions(bp)on the mainFunctionApp. - Read app settings with
os.environoros.getenv. Locally they live in local.settings.json. - Linux is the only supported operating system for the Python runtime stack.
- Use managed identities with Microsoft Entra ID whenever possible. Use Key Vault when the service has no Entra support. Use a shared secret only as a last resort.
AzureWebJobsStorageis required. The app can't start without it. Identity-based form:AzureWebJobsStorage__accountNameandAzureWebJobsStorage__credential=managedidentity. Storage Blob Data Owner is the minimum role for it.- Binding connections take a prefix. Service Bus uses
<PREFIX>__fullyQualifiedNamespace, Queue storage<PREFIX>__queueServiceUriand Cosmos DB<PREFIX>__accountEndpoint. - The system-assigned identity is used by default. A user-assigned identity needs
__credentialand__clientId(or a resource ID, not both).
Hosting plans
| Plan | Timeout default / max | Slots | Notes |
|---|---|---|---|
| Flex Consumption | 30 min / unbounded | Not supported | Linux only. Up to 1,000 on-demand instances per function group. Always ready instances. Use for new serverless apps. |
| Premium | 30 min / unbounded | 3 | Always ready instances avoid cold starts by keeping instances warm. Linux and Windows. Containers on Linux. |
| Dedicated | 30 min / unbounded (Always On) | 1-20 | App Service plan rates. The host can run continuously on a prescribed number of instances. |
| Container Apps | 30 min / unbounded | Not applicable (use revisions) | Linux containers only. |
| Consumption (legacy) | 5 min / 10 min | 2 | Legacy plan. Windows is GA, Linux is retired. |
- Flex Consumption instance memory sizes are 512, 2,048 (default for most scenarios) and 4,096 MB.
- Windows deployments are code-only. Azure Functions doesn't currently support Windows containers.
Linux Consumption: apps still on the end-of-life v3 runtime stop running after September 30, 2026. Hosting on Linux in a Consumption plan retires on 30 September 2028. Migrate to Flex Consumption.
Deployment
| Technology | Flex | Consumption | Premium | Dedicated | Container Apps |
|---|---|---|---|---|---|
| Flex Consumption package deployment | Yes | No | No | No | No |
| ZIP deployment | No | Yes | Yes | Yes | No |
| External package URL | No | Yes | Yes | Yes | No |
| Container image | No | Linux only | Linux only | Linux only | Yes |
| Local Git, FTPS | No | Windows only | Yes | Yes | No |
- Flex Consumption stores the package in a blob deployment container. Container Apps store a container image in a registry.
- Manually sync triggers after External package URL, Local Git or FTPS deployments: restart the app, or POST to the
syncfunctiontriggersAPI. - Remote build on Linux: set
ENABLE_ORYX_BUILD=trueandSCM_DO_BUILD_DURING_DEPLOYMENT=true. Core Tools and the VS Code extension do this by default. Don't setWEBSITE_RUN_FROM_PACKAGEwith a remote build. - Request a remote build when you develop Python on Windows and deploy to Linux, when you use a custom package index, or to reduce package size.
- Deploying new code stops running functions (recreate strategy). Slots give near zero-downtime deployments. A swap doesn't guarantee zero downtime. Sticky (deployment slot) settings don't swap.
- Flex Consumption has no slots. Use rolling updates. The portal editor can't install third-party packages.
CLI and PowerShell
| Task | Azure CLI | PowerShell |
|---|---|---|
| Start the local runtime | func start | - |
| Publish a project with Core Tools | func azure functionapp publish <APP_NAME> | - |
| Zip deploy with Azure CLI | az functionapp deployment source config-zip | - |
| Create an app from a custom container | az functionapp create --image <container> | - |
| Sync triggers by calling the management API | az rest --method post --url https://management.azure.com/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/providers/Microsoft.Web/sites/<APP_NAME>/syncfunctiontriggers?api-version=2016-08-01 | - |
| Update an app created before August 1, 2019 so remote build works | az functionapp update --resource-group <RESOURCE_GROUP_NAME> --name <APP_NAME> | - |
| HTTP trigger, anonymous (Python v2) | - | @app.route(route="hello", auth_level=func.AuthLevel.ANONYMOUS) |
| Queue output binding (Python v2) | - | @app.queue_output(arg_name="msg", queue_name="outqueue", connection="AzureWebJobsStorage") |
| Read an app setting in Python | - | setting_value = os.getenv("myAppSetting", "default_value") |
Exam Tips
Tick each tip once you can answer it without looking.
“A function must start from two sources, such as a timer and a queue” → Two functions, because a function has exactly one trigger. Trap: Adding a second trigger or an input binding to one function doesn't work. Bindings don't start a function.
“New Python app: where are triggers declared?” → Decorators in function_app.py (programming model 2.x). Trap: function.json per function is the 1.x model for legacy apps.
“9:30 AM on weekdays” → 0 30 9 * * 1-5. Trap: NCRONTAB has seconds first. Dropping the last field gives every day.
“HTTP key scoped to one function, not the master key” → authLevel function (the default). Trap: anonymous needs no key. admin needs the master key.
“HTTP function works without a key locally” → Authorization is disabled locally and enforced after publishing. Trap: Don't assume the local behavior holds in Azure.
“HTTP request that runs 4 minutes” → The caller gets an HTTP 502 after 230 seconds; use the Durable async pattern or return at once. Trap: A longer plan timeout doesn't lift the 230-second HTTP limit.
“New serverless Python app with VNet integration” → Flex Consumption plan. Trap: Consumption is legacy. Premium is for continuous or near-continuous apps.
“Code deployment to Flex Consumption” → Package deployment only (blob deployment container). Trap: ZIP, Local Git and container image aren't supported on Flex.
“Deployed by external package URL but new function doesn't fire” → Sync triggers: restart the app or call syncfunctiontriggers. Trap: A remote build setting doesn't sync triggers.
“Python built on Windows, deployed to Linux, wrong libraries” → Remote build: ENABLE_ORYX_BUILD and SCM_DO_BUILD_DURING_DEPLOYMENT set to true. Trap: Don't add WEBSITE_RUN_FROM_PACKAGE. The portal editor can't install packages.
“Queue message keeps failing” → Five tries including the first, then the -poison queue. Trap: The default visibility timeout is zero, not 10 minutes (10 minutes only after a host crash).
“React to deleted Cosmos DB documents” → The Cosmos DB trigger can't. The change feed has inserts and updates only. Trap: Deletions don't appear in the change feed.
“Host storage without secrets” → AzureWebJobsStorage__accountName and __credential=managedidentity, plus Storage Blob Data Owner. Trap: The app can't start without AzureWebJobsStorage. Don't use a shared secret when identity works.
“Zero-downtime on Flex or Container Apps” → Flex: rolling updates. Container Apps: revisions. Trap: Flex and Container Apps have no deployment slots. Swaps on other plans don't guarantee zero downtime.
“Timer app scaled to many instances” → One instance runs the timer, coordinated through blob storage. Trap: Each instance doesn't run its own copy. TimeSpan schedules need an App Service plan.
Sources
- Triggers and bindings in Azure Functions
- Azure Functions scale and hosting
- Deployment technologies in Azure Functions
- Azure Functions HTTP trigger
- Timer trigger for Azure Functions
- Azure Queue storage trigger for Azure Functions
- Azure Service Bus trigger for Azure Functions
- Azure Cosmos DB trigger for Azure Functions
- Python developer reference for Azure Functions
- Configure connections to remote services in Azure Functions
- Azure Functions deployment slots
- Azure Functions Flex Consumption plan hosting
Checked against Microsoft Learn on November 13, 2026.