Compute types

Four ways to run code, each handing more to Azure

Virtual MachinesYour codeRuntime and librariesOperating systemHost and hardwarea whole computer, rentedContainersYour codeRuntime and librariesOperating systemHost and hardwarean application, packagedApp ServiceYour codeRuntime and librariesOperating systemHost and hardwarea web application, uploadedFunctionsYour codeRuntime and librariesOperating systemHost and hardwareone function, run on an eventyou look after itAzure doesFrom left to right you hand more of the stack to Azure, and keep less control of it.A virtual machine is infrastructure as a service: you patch the operating system. A container carries its ownruntime, so it runs the same anywhere, and Azure looks after the host. App Service and Functions are platformservices: you bring code only. Functions is also serverless, so it is billed for the time the code runs.

Virtual Machines, containers, App Service, Functions: each step leaves you less to look after.

Compute types · Going deeper

Containers on Azure

Three ways to run a containerServiceWhat it isChoose it whenAzure Container InstancesRuns a container with nothing else to set upone container, quickly, with no clusterAzure Container AppsThe same, plus load balancing and scaling built ina few services that must scaleAzure Kubernetes Service (AKS)A managed Kubernetes clustermany containers that need orchestrationA container against a virtual machineVirtual machineContainerCarriesa full operating systemthe application and its runtimeStarts inminutessecondsMany on one hosta fewmany: each is smallContainers share the host's kernel. They suit applications split into small services that are deployed and scaled separately.

Container Instances for one container, Container Apps for a few that scale, AKS for orchestration.

Virtual machines

One virtual machine is really five or six resources

RESOURCE GROUPregion: West EuropeVirtual machinea size and an imageOS diska managed diskData disksoptionalVIRTUAL NETWORK · SUBNETNetwork interfacea private IP addressSecurity groupwhich ports are openPublic IPoptionalA virtual machine is never one resource. It arrives with a disk, a network interface and a network to sit in.Creating a VM in the portal creates all of these in the resource group, and each is billed and deleted on its own.You choose the region, the size (CPU and memory), the image (which Windows or Linux), and how it is reached.Delete only the VM and its disk and public IP address remain, still costing money.

A VM needs a disk, a network interface, a virtual network and a rule for which ports are open.

Virtual machines · Going deeper

Virtual machine facts

Virtual machines: the facts that are askedService typeInfrastructure as a service: you install, configure and patch what runs on itChoose it forFull control of the operating system, custom software, moving an existing server as it isSizeA named combination of CPU, memory and disk speed; change it later to scale up or downImageA template for the disk: a version of Windows or Linux, perhaps with software installedBillingFor the time it is allocated. Stop (deallocate) it and compute charges stop; the disks still costUsesTest and development, running peaks in the cloud, disaster recovery, lift and shiftNot forSomething Azure offers as a managed service, unless you need the controlAn image plus a size plus a region is enough to describe a VM you can create again and again.

A VM is infrastructure as a service, billed while it is allocated.

Check yourself

One dayeach mark is a file arriving; the code runs for secondsnothing happens in between

Code must run for a few seconds each time a file arrives, as shown. Which service fits, with the lowest cost?

Staying up and scaling

An availability set spreads machines, a scale set multiplies them

Availability set: spread outRACK 1runningRACK 2power lostRACK 3running4 of 6 machines still runScale set: the count follows the loadquietbusyquietAn availability set keeps machines apart. A scale set changes how many there are.In an availability set Azure places the VMs on different racks of one datacentre and never updates them all at once;the grouping itself is free. A Virtual Machine Scale Set is a group of identical VMs behind a load balancer whosenumber rises and falls automatically. Each bar on the right is one VM.

An availability set keeps VMs on separate racks. A scale set adds and removes identical VMs with the load.

Staying up and scaling · Going deeper

Fault domains and update domains

6 virtual machines in one availability setupdate domain 0update domain 1update domain 2update domain 3update domain 4fault domain 0fault domain 1fault domain 2VM1VM2VM3VM4VM5VM6A fault domain is a rack: shared power and network. An update domain is a group Azure restarts together.Azure deals the VMs out in turn, here over 3 fault domains and 5 update domains. A rack failure stops one row.Planned maintenance restarts one column at a time. An availability set has up to three fault domains and fiveupdate domains by default (twenty at most). It protects within one datacentre; zones protect across them.

A fault domain is a rack. An update domain is a group restarted together.

Azure Virtual Desktop

The desktop runs in Azure and only the screen travels

any devicethe screen onlyAZURE VIRTUAL DESKTOPsign in with Microsoft Entra IDOne Windows virtual machineOne Windows virtual machineseveral users share each machine; desktops, apps and data stay in AzureAzure Virtual Desktop runs Windows desktops in Azure and sends only the screen to the device.People get the same desktop and applications from a laptop, a tablet, a phone or a browser, and nothing is storedon the device, so a lost laptop loses no data. Windows Enterprise multi-session lets many users share onevirtual machine, which costs less than a machine each.

Azure Virtual Desktop gives people a Windows desktop from any device, with the data kept in Azure.

Azure Virtual Desktop · Going deeper

App Service, and the three hosting options

Azure App Service: hosting without servers to manageWhat it hostsWeb applications, APIs, background jobs (WebJobs) and back ends for mobile appsLanguages.NET, Java, Node.js, PHP and Python, on Windows or LinuxBuilt inLoad balancing, automatic scaling, high availability, deployment from GitHub or Azure DevOpsService typePlatform as a service: you publish code, Azure runs and patches the serversPaid byThe App Service plan: the size and number of machines your apps run onThe three hosting options the study guide namesWeb apps (App Service)An HTTP application or API, with the least to look afterContainersAn application packaged with its runtime, portable between hostsVirtual machinesAnything, with full control and the most to look after

App Service hosts web apps and APIs as a platform service. The options are web apps, containers and VMs.

Check yourself

RACK 1RACK 2

Four virtual machines are in an availability set as shown. Rack 1 loses power. How many are still running?

Choosing

Four questions pick the host, most control first

Must you control the operating system?yesVirtual MachinesnoIs it packaged as a container?yesContainer Instances, Container Apps or AKSnoIs it a web application or an API?yesApp ServicenoIs it a short piece of code that reacts to an event?yesFunctionsAsk the questions in this order and stop at the first yes.The order runs from most control to least. An exam question usually hands you the deciding fact: "a legacyapplication that needs a specific operating system" is a virtual machine; "a website, and the team does notwant to manage servers" is App Service; "runs when a message arrives" is Functions.

Control of the OS: VM. A container: container services. A web app: App Service. An event: Functions.

Choosing · Going deeper

Clue words for compute

When the question saysThe service isBecause it"full control of the operating system"Virtual Machinesinfrastructure as a service"identical VMs", "scale automatically"Virtual Machine Scale Setscount follows load"survive a rack failure or planned update"Availability setfault and update domains"survive a datacentre failure"Availability zonesseparate buildings"remote desktop from any device"Azure Virtual DesktopWindows desktops in Azure"web app without managing servers"Azure App Serviceplatform as a service"run a container without managing VMs"Azure Container Instancessimplest container host"orchestrate many containers"Azure Kubernetes Servicemanaged Kubernetes"event-driven", "pay per execution"Azure FunctionsserverlessCompute questions ask who looks after the operating system, and what the unit of work is.

Each compute service has a clue phrase that the exam uses for it.

Check yourself

Staff work from their own tablets and home PCs.They need a full Windows desktop with company apps.No company data may be stored on the device.Several people should share each machine to save cost.

Which service meets every line of this requirement?

Lesson complete

You finished “Compute and application hosting on Azure”

Answer the questions along the way to see your score here.

Open in a new tab