Azure Serverless Tutorials
Explore the world of serverless computing on Azure. Build scalable, event-driven applications without managing infrastructure.
-
Build Your First Azure Function
A step-by-step guide to creating and deploying a simple HTTP-triggered Azure Function.
-
Create Event-Driven Workflows with Logic Apps
Learn how to automate business processes and integrate services using Azure Logic Apps.
-
Securing Azure Functions with API Management
Discover how to protect your serverless APIs using Azure API Management policies.
-
Working with Cosmos DB Triggers and Bindings
Understand how to use Azure Functions triggers and bindings to interact with Azure Cosmos DB.
-
Building Microservices with Azure Container Apps
Deploy and manage containerized microservices using Azure Container Apps, a serverless container platform.
Key Serverless Concepts on Azure
Serverless computing allows you to run your code without provisioning or managing servers. Azure offers a comprehensive suite of serverless services:
- Azure Functions: Event-driven compute service for running small pieces of code (functions).
- Azure Logic Apps: Cloud-based service for creating and running automated workflows that integrate apps, data, services, and systems.
- Azure API Management: A fully managed service that enables customers to publish, secure, transform, maintain, and monitor APIs.
- Azure Event Grid: A fully managed event routing service that enables you to easily build applications with event-based architectures.
- Azure Cosmos DB: A globally distributed, multi-model database service.
- Azure Container Apps: A fully managed serverless container platform for building and deploying modern applications and microservices.
Example: A Simple HTTP-Triggered Azure Function
Here's a basic example of an Azure Function written in C# that responds to an HTTP request:
using System.IO;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
namespace AzureFunctions
{
public static class HelloWorldFunction
{
[FunctionName("HelloWorld")]
public static IActionResult Run(
[HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req,
ILogger log)
{
log.LogInformation("C# HTTP trigger function processed a request.");
string name = req.Query["name"];
string requestBody = await new StreamReader(req.Body).ReadToEndAsync();
dynamic data = JsonConvert.DeserializeObject(requestBody);
name = name ?? data?.name;
string responseMessage = string.IsNullOrEmpty(name)
? "Hello, World! Please pass a name on the query string or in the request body."
: $"Hello, {name}!";
return new OkObjectResult(responseMessage);
}
}
}
To learn more about deploying and running this function, please refer to the Build Your First Azure Function tutorial.