Azure Functions
Overview
Azure Functions is a serverless compute service that lets you run event‑driven code without having to provision or manage infrastructure. Write code in the language of your choice, pay only for the time your code runs, and scale automatically.
Get Started
- Open the Azure Portal and create a new Function App.
- Select a runtime stack (e.g., Node.js, .NET, Python, Java).
- Choose a hosting plan: Consumption, Premium, or Dedicated.
- Deploy your first function using the portal, VS Code, or Azure CLI.
Triggers
Functions are invoked by triggers. Common triggers include:
- HTTP request
- Timer (cron)
- Blob storage changes
- Queue messages
- Event Grid events
Bindings
Bindings simplify input and output connections to other services. You can declaratively bind to:
- Azure Cosmos DB
- Azure Service Bus
- SignalR
- SQL Database
Monitoring & Diagnostics
Azure Functions integrates with Application Insights for live metrics, request tracing, and performance analysis. Enable it during creation or via the portal.
Pricing
Pay only for the compute resources your functions consume. The Consumption plan offers a free grant of 1 million executions per month.
Plan | Billing |
---|---|
Consumption | Per execution & GB‑seconds |
Premium | Pre‑warmed instances + executions |
Dedicated | App Service pricing |
Sample Function – HTTP Trigger (JavaScript)
module.exports = async function (context, req) {
const name = (req.query.name || (req.body && req.body.name)) || "World";
context.res = {
// status: 200, /* Defaults to 200 */
body: `Hello, ${name}!`
};
};
This function returns a greeting based on the name
query string or JSON body.