You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
Building serverless applications requires a different mindset from traditional application development. This lesson covers essential best practices for Azure serverless — from function design and cold start mitigation to security, cost optimisation, and comprehensive monitoring with Application Insights.
Each function should do one thing well:
Good: validateOrder, processPayment, sendConfirmation
Bad: handleEverything, processData, myFunction
Serverless functions may execute multiple times for the same event (at-least-once delivery). Every function must produce the same result regardless of how many times it runs:
// Idempotent — uses upsert, safe to run multiple times
app.storageQueue('processOrder', {
handler: async (message, context) => {
await cosmosContainer.items.upsert({
id: message.orderId, // Same ID = same document
status: 'processed',
processedAt: new Date().toISOString()
});
}
});
Functions are stateless. Never rely on in-memory state between invocations:
Subscribe to continue reading
Get full access to this lesson and all 10 lessons in this course.