Skip to main content

⚡ Azure Functions — Short Notes for Interview

Azure Functions is a serverless compute service in Azure. You write code, and Azure runs it automatically whenever an event triggers it. No need to manage servers or infrastructure.


🟢 1. What is Azure Function?

  • Serverless → pay only for execution time, no VM management.
  • Runs small units of code ("functions") in response to triggers.
  • Supports multiple languages (C#, JavaScript, Python, Java, PowerShell, etc.).

🟢 2. Key Concepts

  • Function App → Container for one or more functions (like a project).
  • Trigger → Event that starts a function (HTTP request, Timer, Blob, Queue, Event Hub, etc.).
  • Binding → Way to connect to other services without boilerplate code.
    • Input Binding: brings data into function.
    • Output Binding: sends data from function.
  • Consumption Plan → Auto-scales and pay-per-use.
  • Premium/Dedicated Plan → Pre-warmed instances, VNET support, higher performance.

🟢 3. Types of Triggers

  • HTTP Trigger → run on API calls.
  • Timer Trigger → run on schedule (CRON).
  • Blob Trigger → run when file uploaded/modified in Blob Storage.
  • Queue Trigger → run when message is added to Azure Storage Queue.
  • Event Hub / Service Bus Trigger → run on event/message arrival.
  • Cosmos DB Trigger → run when document changes in Cosmos DB.

🟢 4. Example: HTTP Trigger (C#)

[FunctionName("HelloFunction")]
public static IActionResult Run(
    [HttpTrigger(AuthorizationLevel.Function, "get", "post")] HttpRequest req,
    ILogger log)
{
    log.LogInformation("C# HTTP trigger executed.");
    string name = req.Query["name"];
    return new OkObjectResult($"Hello {name}");
}

👉 Call: https://<function-app>.azurewebsites.net/api/HelloFunction?name=Tushar


🟢 5. Authorization Levels

  • Anonymous → No key required.
  • Function → Requires function key.
  • Admin → Master key required.
  • Supports Azure AD / Entra ID authentication.

🟢 6. Durable Functions (Stateful Workflows)

  • Built on top of Azure Functions.
  • Lets you write stateful workflows in code.
  • Patterns supported:
    • Function chaining (A → B → C)
    • Fan-out/Fan-in (parallel tasks then aggregate)
    • Human interaction (wait for external input)

🟢 7. Monitoring & Logging

  • Integrated with Application Insights.
  • Tracks execution time, failures, dependencies.

🟢 8. Best Practices

  • Keep functions small and single responsibility.
  • Use retry policies for transient errors.
  • Handle exceptions & logging properly.
  • Choose right hosting plan based on workload.
  • Secure secrets with Azure Key Vault.
  • Version your APIs (for HTTP functions).

🟢 9. Pros & Cons

✅ Pros:

  • Auto scaling, pay-per-use.
  • Easy integration with Azure services.
  • Event-driven, quick to build APIs.

❌ Cons:

  • Cold start latency (Consumption plan).
  • Limited execution time in consumption (5–10 min).
  • Vendor lock-in (Azure specific).

🟢 10. Common Interview Questions

  1. What are triggers and bindings in Azure Functions?
  2. Difference between Consumption, Premium, and Dedicated plans?
  3. How do you secure an HTTP-triggered function?
  4. Explain Durable Functions with a use case.
  5. How do you monitor failures in Azure Functions?
  6. How do you handle configuration and secrets securely?
  7. Difference between Azure Functions and Azure Logic Apps?
  8. What is a cold start? How to reduce it?

Quick Recap for Interview:

  • Azure Function = serverless event-driven code.
  • Key building blocks → Triggers + Bindings.
  • Supports many triggers (HTTP, Timer, Blob, Queue, Cosmos, Event Hub).
  • Plans → Consumption (pay-per-use), Premium (no cold start), Dedicated (App Service plan).
  • Durable Functions → Orchestration + workflows.


Comments

Popular posts from this blog

🏗️ Deep Dive: Understanding Every Concept in Microsoft Entra API Onboarding for .NET Developers

When working with Microsoft Entra (formerly Azure Active Directory), you’ll hear terms like App Registration, Tenant, Client ID, Audience, Scopes, Roles, Tokens, OBO flow , and more. If you’re new, it can feel overwhelming. This guide breaks down every key term and concept , with definitions, examples, and how they connect when you onboard and consume a new API. 🔹 1. Tenant Definition : A tenant in Entra ID is your organization’s dedicated, isolated instance of Microsoft Entra. Think of it like : Your company’s identity directory. Example : contoso.onmicrosoft.com is a tenant for Contoso Ltd. 🔹 2. App Registration Definition : The process of registering an application in Entra to give it an identity and permission to use Microsoft identity platform. Why needed : Without registration, Entra doesn’t know about your app. What it creates : Application (Client) ID – unique identifier for your app Directory (Tenant) ID – your organization’s ID Types of apps : Web ...

🗑️ Garbage Collection & Resource Management in .NET (C#) — Beginner Friendly Guide

When you start working with .NET and C#, one of the biggest advantages is that you don’t need to manually manage memory like in C or C++. The Garbage Collector (GC) does most of the work for you. But here’s the catch — not everything is managed automatically. Some resources like files, database connections, sockets, and native memory still need special handling. This blog will help you understand: ✔ How the GC works ✔ What are managed vs unmanaged resources ✔ The difference between Dispose , Finalize , and using ✔ The Dispose pattern with examples ✔ Best practices every C# developer should know 1) How Garbage Collection Works in .NET Managed resources → Normal .NET objects (string, List, etc.). GC frees them automatically. Unmanaged resources → External resources like file handles, database connections, sockets, native memory. GC cannot clean them up — you must do it. 👉 GC uses a Generational Model for performance: Gen 0 : Short-lived objects (local variables, t...

☁️ Azure Key vault Short Notes

🟢 What is Azure Key Vault? A cloud service for securely storing and accessing secrets, keys, and certificates . Removes the need to keep secrets (like connection strings, passwords, API keys) inside code or config files. Provides centralized secret management, encryption, and access control . 👉 Think of it like a secure password manager but for your applications. 🟢 Key Features Secrets → store text values (e.g., DB connection string, API key). Keys → store cryptographic keys (RSA, EC) for encryption, signing. Certificates → store/manage SSL/TLS certificates. Access Control → Access Policies (older model). Azure RBAC (modern, preferred). Integration → works with App Service, Functions, AKS, VMs, SQL DB, etc. Logging → audit who accessed secrets via Azure Monitor / Diagnostic Logs. 🟢 Why Use Key Vault? Security → secrets are encrypted with HSM (Hardware Security Modules). Compliance → meet industry standards (PCI-DSS, ISO, GDPR). Automation → aut...