Compute
Azure offers compute options ranging from full virtual machines to fully managed serverless — choose based on how much control you need.
| Service | Model | You Manage | Azure Manages |
|---|---|---|---|
| Virtual Machines | IaaS | OS, runtime, app, scaling | Hardware, hypervisor |
| App Service | PaaS | App code, config | OS, runtime, scaling, patching |
| Azure Functions | Serverless | Code only | Everything else |
| AKS | Managed Kubernetes | Pods, Deployments, Helm | Control plane |
| Container Instances | Serverless containers | Container image, config | Infrastructure |
Virtual Machines
Section titled “Virtual Machines”Azure VMs are the equivalent of AWS EC2 — fully configurable virtual machines.
VM Sizes
Section titled “VM Sizes”VM sizes follow a naming convention: Standard_D4s_v5
Standard _ D 4 s _ v5 │ │ │ │ │ │ │ │ │ └─ Version (generation) │ │ │ └─ Premium storage capable │ │ └─ vCPUs │ └─ Family └─ Tier| Family | Optimized For | Example Use Case |
|---|---|---|
| B (burstable) | Baseline + burst | Dev/test, small web servers |
| D (general) | Balanced compute/memory | Web servers, app servers |
| E (memory) | High memory-to-core ratio | Databases, in-memory analytics |
| F (compute) | High CPU-to-memory ratio | Batch processing, gaming servers |
| N (GPU) | GPU workloads | ML training, rendering |
| L (storage) | High throughput local storage | Big data, data warehousing |
Creating a VM
Section titled “Creating a VM”# Create a Linux VMaz vm create \ --resource-group myapp-rg \ --name my-vm \ --image Ubuntu2204 \ --size Standard_D2s_v5 \ --admin-username azureuser \ --generate-ssh-keys \ --assign-identity # enable managed identity
# Open a portaz vm open-port --resource-group myapp-rg --name my-vm --port 80
# SSH inssh azureuser@<public-ip>Availability Options
Section titled “Availability Options”| Option | What It Does | Protects Against |
|---|---|---|
| Availability set | Distributes VMs across fault/update domains in one data center | Hardware failure, planned maintenance |
| Availability zone | Distributes VMs across physically separate data centers | Data center failure |
| VM Scale Set | Auto-scaling group of identical VMs | Load spikes, instance failure |
Pricing Models
Section titled “Pricing Models”| Model | Discount | Commitment | Best For |
|---|---|---|---|
| Pay-as-you-go | None | None | Short-term, unpredictable workloads |
| Reserved Instances | Up to 72% | 1 or 3 years | Steady-state workloads |
| Savings Plan | Up to 65% | 1 or 3 years (flexible) | Flexible commitment across VM sizes |
| Spot VMs | Up to 90% | None (can be evicted) | Fault-tolerant batch jobs, CI/CD |
Custom Script Extension
Section titled “Custom Script Extension”Run a script when a VM boots (like EC2 user data):
az vm extension set \ --resource-group myapp-rg \ --vm-name my-vm \ --name customScript \ --publisher Microsoft.Azure.Extensions \ --settings '{"commandToExecute": "apt-get update && apt-get install -y nginx"}'App Service
Section titled “App Service”App Service is a fully managed PaaS for hosting web apps, APIs, and mobile backends — no infrastructure to manage.
Supported Runtimes
Section titled “Supported Runtimes”.NET, Java, Node.js, Python, PHP, Ruby, Go, and custom containers.
Creating an App Service
Section titled “Creating an App Service”# Create an App Service Plan (the underlying compute)az appservice plan create \ --name myapp-plan \ --resource-group myapp-rg \ --sku B1 \ # Basic tier --is-linux
# Create the web appaz webapp create \ --resource-group myapp-rg \ --plan myapp-plan \ --name my-webapp \ --runtime "PYTHON:3.12"
# Deploy from a Git repoaz webapp deployment source config \ --resource-group myapp-rg \ --name my-webapp \ --repo-url https://github.com/myorg/myapp \ --branch mainApp Service Tiers
Section titled “App Service Tiers”| Tier | Features | Use Case |
|---|---|---|
| Free / Shared | Limited CPU, no custom domain | Testing |
| Basic | Custom domain, manual scale | Dev/test |
| Standard | Auto-scale, staging slots, daily backups | Production |
| Premium | Larger instances, more slots, VNet integration | High-traffic production |
Deployment Slots
Section titled “Deployment Slots”Staging slots let you deploy and test before swapping to production:
# Create a staging slotaz webapp deployment slot create \ --resource-group myapp-rg --name my-webapp --slot staging
# Deploy to stagingaz webapp deployment source config \ --resource-group myapp-rg --name my-webapp --slot staging \ --repo-url https://github.com/myorg/myapp --branch release
# Swap staging to production (zero downtime)az webapp deployment slot swap \ --resource-group myapp-rg --name my-webapp --slot stagingAzure Functions
Section titled “Azure Functions”Azure Functions is the serverless compute service — write code, define a trigger, and Azure handles everything else.
Triggers and Bindings
Section titled “Triggers and Bindings”| Trigger | Fires When | AWS Equivalent |
|---|---|---|
| HTTP | HTTP request received | API Gateway + Lambda |
| Timer | Cron schedule | EventBridge + Lambda |
| Blob Storage | New/modified blob | S3 + Lambda |
| Queue Storage | Message in queue | SQS + Lambda |
| Service Bus | Message in Service Bus | SQS/SNS + Lambda |
| Event Grid | Event published | EventBridge + Lambda |
| Cosmos DB | Document changed | DynamoDB Streams + Lambda |
Creating a Function
Section titled “Creating a Function”# function_app.py (Python v2 model)import azure.functions as funcimport json
app = func.FunctionApp()
@app.route(route="hello", methods=["GET"])def hello(req: func.HttpRequest) -> func.HttpResponse: name = req.params.get('name', 'World') return func.HttpResponse( json.dumps({"message": f"Hello, {name}!"}), mimetype="application/json" )
@app.timer_trigger(schedule="0 */5 * * * *", arg_name="timer")def cleanup(timer: func.TimerRequest) -> None: # runs every 5 minutes perform_cleanup()
@app.blob_trigger(arg_name="blob", path="uploads/{name}", connection="AzureWebJobsStorage")def process_upload(blob: func.InputStream) -> None: # fires when a new blob appears in the "uploads" container data = blob.read() process_file(data)Hosting Plans
Section titled “Hosting Plans”| Plan | Scaling | Timeout | Best For |
|---|---|---|---|
| Consumption | Auto (0 to N, scale to zero) | 5 min (max 10) | Event-driven, variable traffic |
| Premium | Pre-warmed (no cold start) | 60 min | Low latency, VNet integration |
| Dedicated | App Service Plan (always running) | Unlimited | Steady load, existing plan |
Deploy
Section titled “Deploy”# Create a function appaz functionapp create \ --resource-group myapp-rg \ --consumption-plan-location eastus \ --name my-func-app \ --runtime python \ --runtime-version 3.12 \ --storage-account mystorageacct
# Deploy codefunc azure functionapp publish my-func-appAKS (Azure Kubernetes Service)
Section titled “AKS (Azure Kubernetes Service)”AKS is Azure’s managed Kubernetes. Azure manages the control plane (API server, etcd, scheduler); you manage the worker nodes and workloads.
AKS vs AWS EKS
Section titled “AKS vs AWS EKS”| AKS | EKS | |
|---|---|---|
| Control plane cost | Free | $0.10/hour (~$73/month) |
| Node options | VM Scale Sets, Spot, Virtual Nodes | Managed node groups, Fargate |
| Identity | Entra ID + Azure RBAC | IAM |
| Networking | Azure CNI or kubenet | AWS VPC CNI |
| Monitoring | Azure Monitor / Container Insights | CloudWatch Container Insights |
Creating a Cluster
Section titled “Creating a Cluster”az aks create \ --resource-group myapp-rg \ --name my-cluster \ --node-count 3 \ --node-vm-size Standard_D2s_v5 \ --enable-managed-identity \ --generate-ssh-keys
# Get credentialsaz aks get-credentials --resource-group myapp-rg --name my-cluster
# Use kubectlkubectl get nodesNode Pools
Section titled “Node Pools”AKS supports multiple node pools with different VM sizes:
# Add a GPU node poolaz aks nodepool add \ --resource-group myapp-rg \ --cluster-name my-cluster \ --name gpupool \ --node-count 2 \ --node-vm-size Standard_NC6s_v3
# Add a Spot node pool (cheap, interruptible)az aks nodepool add \ --resource-group myapp-rg \ --cluster-name my-cluster \ --name spotpool \ --node-count 5 \ --priority Spot \ --eviction-policy Delete \ --spot-max-price -1 # pay up to on-demand priceVirtual Nodes (Serverless)
Section titled “Virtual Nodes (Serverless)”Virtual Nodes use Azure Container Instances (ACI) as a burst capacity layer — pods scale beyond your node pool without adding VMs:
az aks enable-addons --resource-group myapp-rg --name my-cluster --addons virtual-nodeContainer Instances (ACI)
Section titled “Container Instances (ACI)”ACI runs containers without any infrastructure — no cluster, no nodes. Good for simple, short-lived workloads.
az container create \ --resource-group myapp-rg \ --name my-container \ --image myregistry.azurecr.io/my-app:latest \ --cpu 1 --memory 1.5 \ --ports 80 \ --ip-address PublicACI is like AWS Fargate but simpler (no ECS/EKS — just a container).
Choosing a Compute Service
Section titled “Choosing a Compute Service”| Workload | Recommended Service |
|---|---|
| Traditional server, full OS control | Virtual Machines |
| Web app, no infra management | App Service |
| Event-driven, short-lived (< 10 min) | Azure Functions (Consumption) |
| Containerized app, Kubernetes needed | AKS |
| Simple container, no orchestration | Container Instances |
| Batch processing, fault-tolerant | VM Spot or Functions |
| Low-latency serverless | Azure Functions (Premium) |
Key Takeaways
Section titled “Key Takeaways”- Virtual Machines give full control. Use availability zones for HA and VM Scale Sets for auto-scaling.
- App Service is PaaS for web apps — deployment slots enable zero-downtime releases.
- Azure Functions is serverless — Consumption plan scales to zero; Premium plan eliminates cold starts.
- AKS is managed Kubernetes with a free control plane. Use multiple node pools for different workloads.
- Use managed identities on all compute resources for secure, credential-free access to other Azure services.