Compute types: Virtual machines (VMs), containers, Azure Functions

Azure compute and networking services

📘Microsoft Certified: Azure Fundamentals (AZ-900)


Azure provides different ways to run workloads, which are called compute services. These are the services that allow you to run applications, processes, or code in the cloud. The main compute types in Azure are:

  1. Virtual Machines (VMs)
  2. Containers
  3. Azure Functions (Serverless)

We’ll go through each in detail.


1. Virtual Machines (VMs)

What are they?

  • A Virtual Machine is a full server in the cloud.
  • It behaves like a physical computer: it has an operating system, CPU, memory, and storage.
  • You can install any software on it, just like a physical server.

Key Features

  • Full control: You can choose the OS (Windows or Linux), software, and configurations.
  • Flexible scaling: You can resize the VM (change CPU, memory, disk size) as needed.
  • Persistent storage: Data on the VM is stored on Azure disks and persists even after you stop the VM.

How it’s used in IT

  • Hosting a web server (like IIS or Apache).
  • Running databases (SQL Server, MySQL).
  • Running custom applications that need full OS access.
  • Testing and development environments.

Pros

  • Full control over environment.
  • Can run legacy applications that require a specific OS.
  • Easy to migrate on-premises workloads to Azure.

Cons

  • You are responsible for managing the OS, security patches, and updates.
  • More expensive if running 24/7 compared to serverless or containers for small tasks.

2. Containers

What are they?

  • A container is a lightweight, portable unit that includes an application and everything it needs to run (code, libraries, dependencies).
  • Unlike a VM, it shares the host OS kernel but is isolated from other containers.

Key Features

  • Lightweight: Starts in seconds and uses fewer resources than VMs.
  • Portable: Runs consistently across environments (development, testing, production).
  • Orchestrated with Kubernetes: Azure provides services like Azure Kubernetes Service (AKS) to manage multiple containers.

How it’s used in IT

  • Running microservices, where a large application is split into smaller, independent services.
  • Deploying applications quickly across different environments without worrying about OS differences.
  • Continuous integration/continuous deployment (CI/CD) pipelines.

Pros

  • Faster startup than VMs.
  • Efficient use of resources.
  • Easy to scale and manage large applications.

Cons

  • Less control over OS-level configuration.
  • Requires understanding containerization and orchestration tools.

3. Azure Functions (Serverless)

What are they?

  • Azure Functions is a serverless compute service.
  • You write small pieces of code, called functions, and Azure runs them only when needed.
  • You don’t manage servers—Azure handles scaling and availability automatically.

Key Features

  • Event-driven: Functions can run in response to events (e.g., HTTP requests, messages in a queue, database changes).
  • Automatic scaling: Azure automatically allocates resources based on demand.
  • Pay-per-use: You only pay for the execution time and resources consumed.

How it’s used in IT

  • Processing data uploaded to storage (e.g., resizing images when uploaded to Azure Blob Storage).
  • Handling HTTP requests in APIs.
  • Running scheduled tasks or background jobs.
  • Integrating with other Azure services like Event Grid or Service Bus.

Pros

  • No server management.
  • Scales automatically.
  • Cost-effective for short-lived tasks.

Cons

  • Not ideal for long-running or complex applications.
  • Limited control over underlying environment.

Comparison Table – VM, Containers, Azure Functions

FeatureVirtual Machine (VM)ContainersAzure Functions (Serverless)
OS ControlFull controlLimited (shares host OS)None
Resource UsageHighMediumLow
Startup TimeMinutesSecondsMilliseconds
ScalingManual / Auto (VMSS)Auto with orchestrator (AKS)Fully automatic
BillingPay for uptimePay for running containersPay per execution
Best Use CasesLegacy apps, full controlMicroservices, CI/CDEvent-driven, small tasks

Exam Tips for AZ-900

  • Know definitions: VM, Container, Azure Function.
  • Understand differences in management:
    • VM = you manage OS and patches.
    • Container = you manage app, not full OS.
    • Serverless = Azure manages everything; you only write code.
  • Recognize pricing differences: serverless is pay-per-use, VMs are pay-per-time, containers may vary.
  • Be able to choose the right compute type for scenarios described in exam questions.

Summary

  • Virtual Machines: Full server control, persistent, best for traditional workloads.
  • Containers: Lightweight, portable, efficient for modern microservices.
  • Azure Functions (Serverless): Code-only, event-driven, auto-scaling, pay-per-use.
Buy Me a Coffee