Application development and deployment
To develop and deploy serverless applications with Azure Functions, examine patterns and practices, configure DevOps pipelines, and implement site reliability engineering (SRE) best practices.
For detailed information about serverless architectures and Azure Functions, see:
- Serverless apps: Architecture, patterns, and Azure implementation
- Azure Serverless Computing Cookbook
- Example serverless reference architectures
To plan app development and deployment:
- Prepare development environment and set up workflow.
- Structure projects to support Azure Functions app development.
- Identify app triggers, bindings, and configuration requirements.
Understand event-driven architecture
A different event triggers every function in a serverless Functions project. For more information about event-driven architectures, see:
- Event-driven architecture style.
- Event-driven design patterns to enhance existing applications using Azure Functions
Prepare development environment
Set up your development workflow and environment with the tools to create Functions. For details about development tools and Functions code project structure, see:
- Code and test Azure Functions locally
- Develop Azure Functions by using Visual Studio Code
- Develop Azure Functions using Visual Studio
- Work with Azure Functions Core Tools
- Folder structure
Define triggers and bindings
A trigger invokes a Function, and every Function must have exactly one trigger. Binding to a Function declaratively connects another resource to the Function. For more information about Functions triggers and bindings, see:
- Azure Functions triggers and bindings concepts
- Execute an Azure Function with triggers
- Chain Azure Functions together using input and output bindings
Create the Functions application
Functions follow the single responsibility principle: do only one thing. For more information about Functions development, see:
- Azure Functions developers guide
- Create serverless applications
- Strategies for testing your code in Azure Functions
- Functions best practices
Use Durable Functions for stateful workflows
Durable Functions in Azure Functions let you define stateful workflows in a serverless environment by writing orchestrator functions, and stateful entities by writing entity functions. Durable Functions manage state, checkpoints, and restarts, allowing you to focus on business logic. For more information, see What are Durable Functions.
Understand and address cold starts
If the number of serverless host instances scales down to zero, the next request has the added latency of restarting the Function app, called a cold start. To minimize the performance impact of cold starts, reduce dependencies that the Functions app needs to load on startup, and use as few large, synchronous calls and operations as possible. For more information about autoscaling and cold starts, see Serverless Functions operations.
Manage application secrets
For security, don't store credentials in application code. To use Azure Key Vault with Azure Functions to store and retrieve keys and credentials, see Use Key Vault references for App Service and Azure Functions.
For more information about serverless Functions application security, see Serverless Functions security.
To prepare serverless Functions application for production, make sure you can:
- Fulfill application resource requirements.
- Monitor all aspects of the application.
- Diagnose and troubleshoot application issues.
- Deploy new application versions without affecting production systems.
Define deployment technology
Decide on deployment technology, and organize scheduled releases. For more information about how Functions app deployment enables reliable, zero-downtime upgrades, see Deployment technologies in Azure Functions.
Avoid using too many resource connections
Functions in a Functions app share resources, including connections to HTTPS, databases, and services such as Azure Storage. When many Functions are running concurrently, it's possible to run out of available connections. For more information, see Manage connections in Azure Functions.
Configure logging, alerting, and application monitoring
Application Insights in Azure Monitor collects log, performance, and error data. Application Insights automatically detects performance anomalies, and includes powerful analytics tools to help diagnose issues and understand function usage.
For more information about application monitoring and logging, see:
- Monitor Azure Functions
- Monitoring Azure Functions with Azure Monitor Logs
- Application Insights for Azure Functions supported features
Diagnose and troubleshoot issues
Learn how to effectively use diagnostics for troubleshooting in proactive and problem-first scenarios. For more information, see:
- Keep your Azure App Service and Azure Functions apps healthy and happy
- Troubleshoot error: "Azure Functions Runtime is unreachable"
Deploy applications using an automated pipeline and DevOps
Full automation of all steps from code commit to production deployment lets teams focus on building code, and removes the overhead and potential human error of manual steps. Deploying new code is quicker and less risky, helping teams become more agile, more productive, and more confident about their code.
For more information about DevOps and continuous deployment (CD), see:
- Continuous deployment for Azure Functions
- Continuous delivery by using Azure DevOps
- Continuous delivery by using GitHub Action
Once the application is in production, prepare for scaling and implement site reliability engineering (SRE).
Ensure optimal scalability
For information about factors that impact Functions app scalability, see:
Implement SRE practices
Site Reliability Engineering (SRE) is a proven approach to maintaining crucial system and application reliability, while iterating at the speed the marketplace demands. For more information, see:
For hands-on serverless Functions app development and deployment walkthroughs, see:
For an engineering playbook to help teams and customers successfully implement serverless Functions projects, see the Code-With Customer/Partner Engineering Playbook.