Choosing Between Compute Options in Azure

Choosing Between Compute Options in Azure

A beginner-friendly guide to picking the right place to run your code in Azure: virtual machines, App Service, Functions, containers, Kubernetes, and batch computing, with clear questions, trade-offs, and real examples.

Suppose you need to travel across a city. You could drive your own car, take a taxi, ride a bus, use a bicycle, or hire a driver for a whole week. None of these is the best in every situation. The right choice depends on how far you are going, how many people are with you, how much you want to control, how much you want to pay, and how much effort you want to spend.

Running software in Azure is much the same. Azure offers many compute services, each with its own strengths. Beginners often feel lost, because the names sound similar and every service claims to be easy. In this guide we start from zero, explain every new word the first time it appears, use everyday comparisons, and build up a clear way of thinking, so you can choose well and explain your reasons in a project meeting or an interview.

1What “Compute” Means

Start with the word itself, so every later choice makes sense.

Compute is the power that runs your programs: processors, memory, and the software environment around them. Whenever a website answers a request, a report is generated, or a video is converted, some compute is doing the work. A compute service in Azure is a product that gives you that power in a particular form.

Azure compute services differ mainly in how much of the system you manage and how much Microsoft manages for you. Some give you an empty computer and say, “Everything else is yours.” Others say, “Just give us your code, and we will handle the rest.” The difference between these is the heart of every compute decision.

Everyday analogy

Think about getting a meal. You can buy raw ingredients and cook in your own kitchen, which gives full control and needs the most work. You can use a ready kitchen with tools, and bring only the recipe. You can order a meal kit with most steps prepared. Or you can order food delivered, with no cooking at all. Azure compute options sit along the same line from “do it all yourself” to “just consume.”

Many
Compute services in Azure
No best
One option does not fit every workload
Mix
Real systems often combine several

2Why the Choice Matters

A wrong choice is rarely fatal, but it can be expensive and slow.

Picking the wrong compute service shows up in many ways. A team that chooses virtual machines for a simple website spends months patching servers that App Service would have patched for them. A team that chooses Kubernetes for a tiny application spends more time running the platform than building the product. A team that chooses a simple function for a long, heavy calculation finds that it times out. And a team that runs a steady, busy service on a pay-per-use platform may find the bill larger than expected.

The right choice saves money, reduces risk, speeds up delivery, and makes the system easier to operate. The goal is not the most advanced technology. The goal is the simplest service that safely meets your needs.

A good compute choice gives you

  • Lower operations effort
  • Cost that matches real usage
  • Scaling that fits the workload
  • A team that understands what it runs

A poor choice leads to

  • Wasted time on needless server care
  • Surprise bills from a mismatched pricing model
  • Hitting limits late in the project
  • Costly rework and migration

3Core Concepts: The Hosting Models

Four simple ideas organize almost every Azure compute service.

Infrastructure as a Service (IaaS)

IaaS gives you raw computing resources, mainly virtual machines. You choose the operating system, install the software, apply security updates, and handle most of the setup. Microsoft manages the physical buildings, hardware, and the virtualization layer underneath. You gain maximum control and take on maximum responsibility.

Platform as a Service (PaaS)

PaaS gives you a ready platform for running your application. Microsoft manages the servers and the operating system, and often the runtime and scaling features. You bring your code and settings. App Service is the classic example.

Containers as a Service and orchestration

A container is a lightweight package holding an application and everything it needs to run. Container services run these packages for you. Some are simple, such as Container Instances, some add automatic scaling and traffic handling, such as Container Apps, and some give full control through Kubernetes, an open system that schedules and manages many containers across many machines.

Function as a Service (FaaS) and serverless

Serverless means that you do not manage servers, and you are usually charged only when your code runs. Azure Functions is the best-known example, where you write small pieces of code that run in response to events, such as a message arriving or a file being uploaded.

flowchart LR
    A["More control, more work - Virtual Machines"] --> B["Dedicated Hosts and VM Scale Sets"]
    B --> C["Kubernetes Service - AKS"]
    C --> D["Container Apps and Container Instances"]
    D --> E["App Service"]
    E --> F["Azure Functions - serverless"]
    F --> G["Less control, less work"]
    
Figure 1: The spectrum from full control to full convenience
i
Remember this

Moving right on this line gives you less to manage but fewer choices about the environment. Moving left gives you more freedom but more things to look after. Start as far right as your needs allow.

4Meet the Main Options

A short introduction to each service before we compare them.

IaaS

Virtual Machines

Rented computers in the cloud with full control of the operating system. Best for older applications, special software, or custom setups.

IaaS

Virtual Machine Scale Sets

Groups of identical virtual machines that can grow and shrink automatically and spread across zones.

PaaS

App Service

Managed hosting for web apps and APIs, with slots, certificates, scaling, and easy deployment.

Serverless

Azure Functions

Small event-driven functions that scale automatically and can cost nothing when idle on suitable plans.

Containers

Container Apps

A serverless platform for containers and microservices with automatic scaling, including down to zero.

Containers

Container Instances

The simplest way to run a single container or a small group, billed per second.

Containers

Kubernetes Service (AKS)

Managed Kubernetes for large, complex container platforms that need full control and a big ecosystem.

Batch

Azure Batch

Runs large numbers of parallel or high-performance jobs on pools of machines it creates and removes for you.

Some other specialized options

  • Azure Dedicated Host gives you a physical server for your own use, useful for strict compliance or for software licensing rules that require dedicated hardware.
  • Azure VMware Solution lets organizations run existing VMware environments in Azure with little change.
  • Azure Virtual Desktop runs desktops and apps in the cloud for remote users, which is a different kind of workload from hosting services.
  • Azure Static Web Apps hosts static sites and single-page apps with optional serverless back ends.
  • Service Fabric is an older microservices platform that is still used by some large systems, though many new projects choose containers instead.
!
Warning

Azure services are renamed, merged, and retired over time, and capabilities grow. Confirm the current status of any service on Microsoft’s official documentation before building a long-term design on it.

5The Questions That Drive the Decision

Ask these in order, and the right service usually becomes clear.

01

Are you moving an existing system or building a new one?

Existing software with special needs often starts on virtual machines. New software has more freedom to use managed platforms.

02

What does the workload do?

Is it a website, an API, a background job, an event handler, a batch calculation, or a long-running service?

03

How much control do you need?

Do you need to install special software, choose the operating system, tune the kernel, or control networking in fine detail?

04

How does the load behave?

Is it steady, spiky, rare, or predictable by the hour? Does it need to scale to zero when idle?

05

What can your team operate?

A small team without platform experts should favor managed services. A large platform team may take on Kubernetes.

06

What are the rules and limits?

Consider compliance, data location, network isolation, execution time limits, and licensing.

07

What is the budget model?

Pay-per-use suits irregular work. Reserved capacity suits steady work.

The main decision criteria in a table

CriterionWhy it matters
ControlMore control allows special software and tuning, but means more to manage
Operations effortPatching, scaling, and monitoring consume team time
ScalabilityHow easily the service handles growth and sudden bursts
Start-up timeFunctions and containers start in seconds, while virtual machines take longer
Cost modelPay per use, per hour, or per commitment, each fits a different pattern
State and storageWhether the app keeps data locally or in external services
Networking and isolationPrivate networks, firewalls, and compliance needs
PortabilityHow easy it is to move to another platform or cloud later
SkillsWhat your people already know and can support
Time to marketHow quickly you can deliver the first working version

6A Decision Tree

A visual path from a first question to a likely answer.

flowchart TD
    START["What do you need to run?"] --> Q1{"Moving an existing app with special OS or software needs?"}
    Q1 -- Yes --> VM["Virtual Machines or Scale Sets"]
    Q1 -- No --> Q2{"Is it large parallel or high-performance batch work?"}
    Q2 -- Yes --> BATCH["Azure Batch"]
    Q2 -- No --> Q3{"Is it small code triggered by events?"}
    Q3 -- Yes --> FUNC["Azure Functions"]
    Q3 -- No --> Q4{"Is it a web app or API?"}
    Q4 -- Yes --> Q5{"Is it packaged as many containers or microservices?"}
    Q5 -- Yes --> Q6{"Need full Kubernetes control and ecosystem?"}
    Q6 -- Yes --> AKS["Kubernetes Service - AKS"]
    Q6 -- No --> CA["Container Apps"]
    Q5 -- No --> AS["App Service"]
    Q4 -- No --> Q7{"Short single container job or quick task?"}
    Q7 -- Yes --> ACI["Container Instances"]
    Q7 -- No --> Q8{"Long-running service in a container?"}
    Q8 -- Yes --> CA2["Container Apps or App Service for containers"]
    Q8 -- No --> VM2["Virtual Machines for custom needs"]
    
Figure 2: A simplified path for choosing a compute service

Use this map as a guide, not a law. Real decisions may involve exceptions, such as a web app that must run on a very special runtime, which pushes you to containers or virtual machines even though it is a web app. Always test your assumptions with a small trial before committing.

7Virtual Machines and Scale Sets

The foundation, with the most freedom and the most responsibility.

A virtual machine behaves like a complete computer. You pick the operating system, the size, the disks, and the network. You then install and maintain everything that runs on it. This is why virtual machines are the right answer when you must run older applications that need a specific environment, special drivers, unusual software, or licensed products that cannot move to a platform service.

A Virtual Machine Scale Set manages a group of identical virtual machines. It can add or remove machines automatically based on load, and can spread them across availability zones, which are separate physical sites inside a region. This gives you scaling and resilience for workloads that must stay on virtual machines.

Choose virtual machines when

  • You are moving an existing application with little change, called lift and shift
  • You need full control of the operating system
  • You use special software, drivers, or licensing
  • You need very specific hardware, such as large memory or GPUs
  • You must meet strict compliance needs with dedicated hosts

Watch out for

  • You patch and secure the operating system yourself
  • You must design scaling and recovery
  • Paying while the machine runs, even when idle
  • Slower to start and to scale than containers or functions
  • More operational work for a small team

Price options for virtual machines

Virtual machines can be paid for in several ways: pay-as-you-go by the second, reserved instances or savings plans that give a discount in exchange for a one- or three-year commitment, Spot virtual machines that use spare capacity at a deep discount but can be taken away at short notice, and Azure Hybrid Benefit, which lets you reuse eligible Windows Server or SQL Server licenses. These options can make virtual machines very economical for steady, predictable work.

Production example: a company moving an old accounting system

A company runs an older accounting application that depends on a particular Windows version and a licensed database. It moves the whole system to Azure virtual machines with minimal change, then modernizes pieces over time. Virtual machines let it move fast without rewriting the software.

8App Service

The comfortable default for many web applications.

Azure App Service hosts web applications and web APIs on a managed platform. You choose a plan, which defines the size and number of machines, and place your apps in it. Microsoft handles operating system updates, load balancing, and many security tasks. You gain features such as deployment slots, which are live staging copies for safe releases, managed certificates, built-in sign-in support, autoscale, and easy integration with pipelines.

Choose App Service when

  • You are building a typical web application or API
  • You want minimal operations work
  • You want safe releases with slots
  • You use common languages such as .NET, Java, Node.js, Python, or PHP
  • You need simple scaling and standard web features

Watch out for

  • The plan bills continuously, even when traffic is low
  • Less control over the environment than virtual machines
  • Not designed for very specialized runtimes or non-web workloads
  • Some features depend on the pricing tier

Production example: a company website and customer portal

A business hosts its customer portal and API on App Service in a Standard plan. Releases go through a staging slot, certificates renew automatically, and two instances keep the site available if one fails. The small team spends its time on features, not servers.

9Azure Functions

Small pieces of code that run when something happens.

Azure Functions lets you write a small piece of code, called a function, that runs in response to a trigger. A trigger is an event, such as an incoming web request, a message in a queue, a new file in storage, or a timer. The platform starts your code, runs it, and scales out automatically when many events arrive. On suitable plans, you pay only for the time your code runs, and nothing when it is idle.

Functions come with different hosting plans. Some are purely pay-per-use and scale to zero, some keep pre-warmed instances to reduce start delays, and some run on a plan you control, such as an App Service plan. Names and details of these plans have changed over time, so check the current documentation.

Choose Functions when

  • Work is triggered by events
  • Each piece of work is short and independent
  • Traffic is irregular or unpredictable
  • You want to pay only for actual execution
  • You want to glue services together quickly

Watch out for

  • Execution time limits on some plans
  • Cold starts, which are start-up delays after idle time
  • Hard to manage very large numbers of tangled functions
  • Local state does not last between runs
  • Costs can grow for constant, heavy load compared with reserved options

Production example: processing uploaded images

A photo-sharing service stores uploads in Blob Storage. Each new file triggers a function that creates thumbnails and writes metadata. On quiet days the cost is almost nothing, and on busy days the platform runs many copies in parallel.

10Container Apps, Container Instances, and AKS

Three ways to run containers, from simple to powerful.

Azure Container Instances

Container Instances run a single container or a small group with almost no setup, billed per second. They suit short jobs, quick tests, build agents, and simple small tools. They have no built-in automatic scaling or load balancing, so they are not meant for large, busy systems.

Azure Container Apps

Container Apps is a serverless platform for running containers, microservices, and background jobs. It adds automatic scaling based on traffic or events, including scaling to zero, built-in traffic management, versions called revisions, and support for common microservice tools. You do not manage a Kubernetes cluster, even though Container Apps is built on Kubernetes technology underneath.

Azure Kubernetes Service

AKS provides managed Kubernetes. Microsoft manages the control plane, which is the brain of the cluster, while you manage the worker machines, called nodes, and the workloads on them, though newer automatic modes shift more of this work to Microsoft. You gain full access to the Kubernetes ecosystem, with fine control over networking, scheduling, and extensions. You also take on more complexity, so teams need the skills to run it.

QuestionContainer InstancesContainer AppsAKS
Best forShort jobs and simple toolsMicroservices and web containers with auto scalingLarge, complex platforms with many teams
Automatic scalingNoYes, including to zeroYes, with configuration
Operations effortVery lowLowHigher
ControlLowMediumHigh
Kubernetes skills neededNoneLittle or noneYes
Typical teamAnyoneSmall and mid-size product teamsDedicated platform or operations team
Everyday analogy

Container Instances are like renting a bicycle for a short ride. Container Apps are like using a managed taxi service that fits the trip for you. AKS is like owning and running a whole fleet of vehicles, where you can build any route you like but you need drivers, mechanics, and a depot.

Production example: a growing product with many small services

A company building an online platform with dozens of small services starts on Container Apps for its automatic scaling and low operations load. Years later, with a large platform team and special networking needs, a few services move to AKS. The container images stay the same, so the move is manageable.

11Azure Batch and Heavy Computing

For work that needs many machines for a short time.

Azure Batch is built for large-scale parallel and high-performance computing. You describe a set of tasks, and Batch creates a pool of virtual machines, spreads the tasks across them, retries failures, and removes the machines when the work is finished. You pay for the virtual machines while they run, and there is no extra charge for the Batch service itself in most cases.

Typical uses include video rendering, financial risk simulations, scientific modeling, and large data conversions. For such work, using many cheap Spot machines can cut cost greatly, because the job scheduler can restart tasks if a machine is taken away.

sequenceDiagram
    participant U as You or Pipeline
    participant B as Azure Batch Service
    participant P as Pool of Virtual Machines
    participant S as Storage
    U->>B: Submit job with thousands of tasks
    B->>P: Create or resize pool of machines
    B->>P: Spread tasks across machines
    P->>S: Read input files
    P->>S: Write results
    P-->>B: Report task success or failure
    B->>P: Retry failed tasks
    B-->>U: Job completed
    B->>P: Remove machines when idle
    
Figure 3: How Azure Batch runs a large parallel job

Production example: rendering animation frames

A studio needs to render thousands of frames. It submits them to Batch, which creates hundreds of machines for a few hours and removes them afterwards. The studio avoids owning a large render farm that would sit idle most of the year.

12Side-by-Side Comparison

One table to hold the whole picture.

ServiceModelYou manageScalingCost patternBest for
Virtual MachinesIaaSOS, runtime, apps, patchingManual or via scale setsPer second while running, reservations availableLift and shift, special software
Scale SetsIaaSImage, apps, rulesAutomatic by rulesPay for each running instanceLarge groups of identical servers
App ServicePaaSApp code and settingsManual and autoscalePer plan while it existsWeb apps and APIs
FunctionsServerlessFunction codeAutomatic by eventsOften pay per execution, plans varyEvent-driven short tasks
Container AppsServerless containersImages and settingsAutomatic, to zeroPer usage, with some free allowancesMicroservices, web containers, jobs
Container InstancesServerless containersImage and settingsNone built inPer second for CPU and memoryShort jobs and simple tools
AKSManaged KubernetesNodes, workloads, add-onsAutomatic with setupPay for node machines and extrasLarge complex container platforms
BatchJob scheduling on VMsTask definitions and imagesPools scale for the jobPay for machines usedParallel and high-performance jobs
i
Good to know

Pricing details and plan names change frequently. Use the Azure pricing calculator with your real numbers instead of relying on general rules, because a small difference in hours, size, or traffic can change which option is cheapest.

13Cost and the Utilization Idea

The cheapest service depends on how busy your workload is.

Utilization means how much of your paid capacity you actually use. A pay-per-use service costs little when your work is rare, and more as your work becomes constant. A reserved or always-on service costs the same whether busy or idle, so it wins when it is nearly always busy.

flowchart LR
    LOW["Rare or spiky workload"] --> PAY["Pay-per-use options - Functions, Container Apps, Container Instances"]
    MID["Moderate steady workload"] --> PLAN["Plan-based options - App Service and small VM groups"]
    HIGH["Constant heavy workload"] --> RES["Reserved capacity - VMs, scale sets, AKS nodes with commitments"]
    
Figure 4: Matching the cost model to how busy the workload is

Ways to lower the bill

Commit

Reservations and savings plans

Promise steady usage for one or three years in return for lower prices on supported services.

Spare

Spot capacity

Use spare capacity at a deep discount for work that can be interrupted, such as batch jobs.

Licenses

Hybrid Benefit

Reuse existing Windows and SQL licenses to reduce costs where eligible.

Size

Right-size and auto scale

Choose the smallest size that works, and let rules add capacity only when needed.

Remember hidden costs as well. These include time spent on patching and operations, data leaving Azure, storage, logging, load balancers, and support plans. A virtual machine may look cheaper per hour than a platform service, yet cost more once you count the people needed to run it.

14Security, Networking, and Compliance Considerations

Every compute choice changes who is responsible for what.

The shared responsibility model

Microsoft always protects the physical data centers and underlying hardware. As you move toward more managed services, Microsoft also takes over more of the software layers. With virtual machines you patch the operating system. With App Service Microsoft patches the platform, and you secure your code and settings. With functions, even more is handled for you. In every case, you still own your data, your identities, and your configuration.

LayerVirtual MachinesApp ServiceFunctions
Physical datacenterMicrosoftMicrosoftMicrosoft
Operating system patchesYouMicrosoftMicrosoft
Runtime and web serverYouMostly MicrosoftMicrosoft
Application codeYouYouYou
Data and identitiesYouYouYou

Common security practices across all options

  • Use managed identities. These let a compute resource prove who it is to other services without stored passwords.
  • Keep secrets in Azure Key Vault instead of in code or settings.
  • Use private networking with virtual networks and private endpoints for internal workloads.
  • Apply least privilege with role-based access control, giving only needed permissions.
  • Put a web application firewall in front of public applications.
  • Use Microsoft Defender for Cloud to find weaknesses and respond to threats.
  • Use Azure Policy to require approved regions, encryption, and private access.
!
Warning

Some compliance rules require things that only certain services can provide, such as dedicated hardware, specific regions, or customer-managed encryption keys. Check requirements before choosing, not after.

15Availability, Scaling, and Reliability

Each service offers different ways to survive failure.

No matter which service you choose, the basic rules of reliability are the same. Run more than one copy, spread across availability zones where supported, put a load balancer or global entry point in front, keep data outside the compute layer, and watch everything with monitoring and alerts. Each service has its own settings for these.

flowchart TD
    USERS["Users"] --> FD["Azure Front Door - global entry and firewall"]
    FD --> WEB["App Service - zone-redundant web front end"]
    WEB --> API["Container Apps - scalable API and microservices"]
    API --> Q["Service Bus queue - smooths bursts"]
    Q --> FN["Azure Functions - event-driven workers"]
    API --> DB["Azure SQL Database - zone-redundant"]
    FN --> DB
    FN --> BLOB["Blob Storage - files and results"]
    JOB["Azure Batch - nightly heavy processing"] --> BLOB
    WEB --> MON["Azure Monitor and Application Insights"]
    API --> MON
    FN --> MON
    
Figure 5: A real system often mixes several compute services

Scaling styles

  • Scale up means using a bigger machine, which is simple but has a ceiling.
  • Scale out means adding more copies, which is usually better for resilience and growth.
  • Scale to zero means running nothing when idle, which only some serverless services offer.
  • Event-driven scaling adds capacity based on queue length or event rate, not only processor use.
i
Tip

Scaling the compute tier does not help if the database is the bottleneck. Always check the full chain from front door to data store, and scale the weakest link.

16Monitoring, Logging, and Operations

How much effort you spend running things depends on the choice.

All Azure compute services connect to Azure Monitor, which collects metrics, meaning numbers over time such as processor use or request counts, and logs, meaning written records of events. Application Insights looks inside your running application and tracks slow calls, errors, and dependencies. Alerts notify people when limits are crossed.

The level of operations work, however, differs. With virtual machines you must also monitor disk space, security updates, and agent health. With platform and serverless services, Microsoft handles much of that, and you focus on application-level signals. When comparing options, include the cost of this operational effort, because it often decides the true winner.

Operations taskVirtual MachinesApp ServiceFunctions and Container AppsAKS
Operating system patchingYouMicrosoftMicrosoftShared, depending on mode
Scaling setupYou design itRules and plan sizeMostly built inYou configure it
Version upgradesYouMostly Microsoft, you choose runtime versionsMostly MicrosoftYou plan cluster upgrades
Load balancingYou add itBuilt inBuilt inYou configure ingress
Overall effortHighestLowLowestHigh

17Migration Paths and Changing Your Mind

Your first choice is not your last.

Many companies move through stages. They start by moving old systems to virtual machines, which is called rehosting or lift and shift. Later they replatform, moving the same app to a managed platform such as App Service with small changes. Finally they may refactor the app into smaller services running on containers or functions. Each step reduces operations effort and often cost, though it needs time and engineering work.

01

Rehost on Virtual Machines

Move quickly with little change. Gain cloud benefits such as flexible capacity and easier backups.

02

Replatform on App Service or managed databases

Swap pieces for managed services to cut patching and improve scaling.

03

Containerize

Package the application in containers for portability and consistent environments.

04

Refactor into services and functions

Split the system into smaller parts that scale independently and use events.

05

Optimize continuously

Review cost, performance, and operations regularly and adjust the mix.

i
Tip

Keep your options open by using containers, standard databases, and Infrastructure as Code, which means describing your setup in text files. These choices make it much easier to move between compute services later.

18Anti-Patterns to Avoid

Common mistakes in choosing compute.

ANTI-PATTERN 01Avoid
What it is

Choosing Kubernetes first because it is fashionable, for a small, simple application.

Why it hurts

The team spends more time running the platform than building the product.

Better approach

Begin with App Service or Container Apps, and move to AKS only when real needs demand it.

ANTI-PATTERN 02Avoid
What it is

Using virtual machines for everything out of habit.

Why it hurts

You inherit patching, scaling, and security work that managed services would remove.

Better approach

Use virtual machines for real needs, and prefer platform or serverless services for the rest.

ANTI-PATTERN 03Avoid
What it is

Forcing long, heavy, constant work into small event-driven functions.

Why it hurts

You hit time limits, tangle your design, and may pay more than on reserved capacity.

Better approach

Use containers, Batch, or virtual machines for long-running or heavy jobs, and keep functions for short event-driven tasks.

ANTI-PATTERN 04Avoid
What it is

Picking by price per hour alone.

Why it hurts

You ignore operations time, scaling needs, and risk, so the cheapest line on the price list becomes the most expensive in practice.

Better approach

Compare total cost, including people, tools, and risk, and test with realistic workloads.

ANTI-PATTERN 05Avoid
What it is

Insisting on one compute service for the entire company.

Why it hurts

Different workloads have different needs, and a single choice forces poor fits.

Better approach

Offer a small, well-governed menu of approved services, and let teams pick the right one from it.

!
Myth

“Serverless is always cheaper and always better.” Not true. It is excellent for spiky or event-driven work, but constant heavy workloads, special runtimes, or very low-latency needs can fit other services better.

19Worked Examples

See the thinking applied to realistic situations.

Example 1: A small business website with a customer database

The site is a typical web application, traffic is moderate, and the team is small. App Service with a managed database is the natural choice. It is simple, secure, and cheap to run, and avoids server care entirely.

Example 2: Resizing images when users upload photos

Work is triggered by an upload event, each task is short, and traffic is irregular. Azure Functions fits well, with storage events as triggers. The bill follows usage closely.

Example 3: A bank’s legacy system with a vendor-supplied installer

The software needs a specific Windows version and cannot be repackaged. Virtual machines, perhaps in a scale set across zones with Hybrid Benefit, are the practical choice. The bank can plan a slower modernization afterwards.

Example 4: A new product made of many small services

A start-up designs a set of microservices that must scale independently and sometimes to zero. Container Apps gives automatic scaling and low operations work, with the option to move to AKS if the platform grows far beyond its needs.

Example 5: A research team running millions of simulations

The work is large, parallel, and not time-critical per task. Azure Batch with Spot machines creates large pools for the run and removes them afterwards, giving big compute power at a low cost.

Example 6: A nightly report that runs for twenty minutes

The job is a single container that runs once and finishes. Container Instances, started by a scheduled workflow, run it and are deleted afterwards, so there is no idle cost.

Example 7: A large enterprise platform with many teams and strict networking

Dozens of teams need a shared, standard container platform with advanced policies, custom networking, and a rich tool ecosystem. A dedicated platform team runs AKS and offers it to the others as an internal service.

Choose the simplest service that safely meets your needs, and keep a path open to something bigger.

20Best Practices Checklist

A short list to use on your next project.

  • Start from requirements. Write down what the workload does, how it scales, what rules apply, and what the team can support.
  • Prefer the most managed service that fits. Move left on the spectrum only for real reasons.
  • Prototype before committing. Run a small trial of your top two choices with realistic data.
  • Compare total cost. Include operations effort, licensing, networking, and monitoring.
  • Design for failure. Use zones, multiple instances, and health checks regardless of the service.
  • Keep apps stateless and store data in managed storage and databases.
  • Secure by default. Managed identities, Key Vault, private networking, and least privilege.
  • Automate infrastructure. Use templates and pipelines so any choice can be rebuilt or changed.
  • Monitor consistently. Send logs and metrics to a shared workspace and alert on user-facing symptoms.
  • Review regularly. Workloads change, and so do services, prices, and team skills.
  • Document the decision. Record why you chose a service, so future teams understand and can revisit it.

21Frequently Asked Questions

Q1What is the simplest way to choose a compute service?
Ask what you are running, how much control you need, how it scales, and what your team can operate. Then pick the most managed service that meets those needs.
Q2When should I use virtual machines?
Use them when you must control the operating system, run special or older software, meet specific hardware or licensing needs, or move an existing system quickly with little change.
Q3Is App Service better than virtual machines?
For typical web apps and APIs, usually yes, because it removes server management. For special software or deep control, virtual machines are more suitable.
Q4What is the difference between Functions and Container Apps?
Functions runs small pieces of code triggered by events. Container Apps runs full containers, including long-running web services and microservices, with automatic scaling.
Q5Do I need Kubernetes?
Often no. Choose AKS when you need full Kubernetes control, advanced networking, or a large ecosystem of tools, and have the skills to run it.
Q6Which option is cheapest?
It depends on how busy the workload is. Pay-per-use options win for rare or spiky work, and reserved capacity wins for constant heavy work. Always calculate with real numbers.
Q7Can I use more than one compute service together?
Yes, and most real systems do. For example, App Service for the website, Container Apps for services, Functions for events, and Batch for heavy jobs.
Q8How hard is it to switch later?
It varies. Using containers, standard databases, and Infrastructure as Code makes switching much easier. Heavy use of one service’s special features makes it harder.
Q9What is the best choice for a beginner?
App Service is a friendly place to start for web apps, and Functions is simple for event-driven tasks. Learn virtual machines too, because they teach the foundations.
Q10How do I prove my choice is right?
Run a small realistic test, measure cost, performance, and effort, and compare with your goals. Record the result and review it as the workload changes.

22Summary and Key Takeaways

Key Takeaways

  • Compute services sit on a line from control to convenience. Virtual machines give the most control and work, while App Service, containers, and serverless give less control and less work.
  • Match the service to the workload. Use virtual machines for special or legacy needs, App Service for web apps and APIs, Functions for event-driven tasks, Container Apps for scalable containers, Container Instances for short jobs, AKS for complex platforms, and Batch for large parallel computing.
  • Ask the right questions in order. New or existing system, type of work, control needed, load pattern, team skills, rules and limits, and cost model.
  • Count the full cost. Pay-per-use suits rare or spiky work, reserved capacity suits steady heavy work, and people’s time for operations often outweighs small price differences.
  • Reliability, security, and monitoring apply to every choice. Run several copies across zones, keep data outside compute, use managed identities and Key Vault, and watch with Azure Monitor.
  • Keep it simple and stay flexible. Choose the most managed service that fits, mix services where sensible, use containers and templates for portability, and review the decision as needs change.