You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
Azure Functions is Azure's event-driven, serverless compute service. It lets you run small pieces of code — called functions — without provisioning or managing servers. Each function is triggered by an event, executes its logic, and returns a result. This lesson covers the fundamentals: creating your first function, understanding the project structure, supported languages, and the development workflow.
An Azure Function is a single unit of execution — a method or function in code — that runs in response to a trigger. Functions are:
A function app is the container that hosts one or more related functions. It provides the execution context, configuration, and deployment unit. All functions within a function app share the same configuration, connection strings, and pricing plan.
Azure Functions supports multiple languages across two programming models:
The function runs inside the Azure Functions host process:
| Language | Runtime |
|---|---|
| C# (class library) | .NET 6/8 |
The function runs in a separate worker process, offering greater flexibility:
| Language | Runtime |
|---|---|
| C# (isolated) | .NET 6/8/9 |
| JavaScript/TypeScript | Node.js 18/20 |
| Python | 3.9/3.10/3.11 |
| Java | 8/11/17/21 |
| PowerShell | 7.2/7.4 |
| Go, Rust, etc. | Custom handlers |
Recommendation: For new C# projects, always use the isolated worker model. The in-process model is being phased out.
Install the following tools:
# Install Azure Functions Core Tools (macOS)
brew tap azure/functions
brew install azure-functions-core-tools@4
# Create a new function app project
func init MyFunctionApp --worker-runtime javascript
# Navigate into the project
cd MyFunctionApp
# Create a new HTTP-triggered function
func new --name HelloWorld --template "HTTP trigger"
After initialisation, the project looks like this:
MyFunctionApp/
├── src/
│ └── functions/
│ └── HelloWorld.js # Your function code
├── host.json # Global configuration for the function app
├── local.settings.json # Local environment variables and connection strings
├── package.json # Node.js dependencies
└── .funcignore # Files to exclude from deployment
const { app } = require('@azure/functions');
app.http('HelloWorld', {
methods: ['GET', 'POST'],
authLevel: 'anonymous',
handler: async (request, context) => {
context.log('HTTP trigger function processed a request.');
const name = request.query.get('name')
|| (await request.text())
|| 'World';
return { body: `Hello, \${name}!` };
}
});
Subscribe to continue reading
Get full access to this lesson and all 10 lessons in this course.