"Compute" in Azure means: your program runs somewhere on processors and memory. The only question is how much of the surroundings you want to handle yourself. A virtual machine gives you a whole operating system to manage. A container takes the operating system off your hands. Azure Functions takes the server off your hands entirely, and you deliver only code. From module B1 you already know this idea as IaaS, PaaS and serverless. This lesson shows the Azure services behind it.
Virtual machines
An Azure Virtual Machine (VM) is a virtualized server in Azure and a service of the Infrastructure as a Service (IaaS) kind. As with a real server, you decide on the operating system and the software on it. In return you also patch and configure the machine yourself. According to Microsoft, VMs fit when you need full control over the operating system, want to run your own software or need a special hosting configuration. Typical uses: test and development, running applications, extending your own datacenter, disaster recovery and moving existing servers ("lift and shift").
What belongs to a VM
When you create one, you choose the size (number of processor cores and amount of memory), the disks and the network. Azure sorts sizes into families, for example B for inexpensive test workloads, D for general purposes, E for a lot of memory, F for a lot of compute power and N with a GPU. Alongside the machine, supporting resources are created, by default in the same resource group:
- a virtual network with a subnet
- a network interface (NIC) that connects the VM to the network
- a private IP address and sometimes a public one
- a network security group (NSG) that allows or blocks traffic
- an operating system disk and, if needed, further disks
- in some cases a license for the operating system
Important for costs: These supporting resources partly have costs of their own, such as disks and IP addresses. A network interface or a network security group, by contrast, costs nothing extra.
Groups of VMs
Single VMs are enough for tests. For higher availability you group them:
- Virtual Machine Scale Sets create and manage groups of identical VMs with load balancing. The number of instances can grow and shrink automatically on demand or on a schedule.
- Availability sets distribute VMs within a region across update domains and fault domains. That way a maintenance event or a hardware failure doesn't hit all of them at once. They cost nothing extra, you pay only for the VMs. Microsoft now recommends scale sets with flexible orchestration for high availability, and in regions with availability zones, zone-based designs are usually preferable.
Azure Virtual Desktop
Azure Virtual Desktop is a service for virtualizing desktops and applications: Users reach a Windows desktop or individual apps from the cloud, from many device types and locations. It is tied to Microsoft Entra ID and supports single-session and multi-session. It is suitable when many people need centrally managed desktops, such as a distributed support team.
Containers
A container runs on a host like a VM, but brings no operating system of its own to manage. Containers are lightweight and can be created, enlarged and stopped quickly. Azure supports Docker, one of the most widespread container engines. Microsoft names three services, from "quickly started" to "deeply managed":
- Azure Container Instances: the fastest, simplest way to start a container without managing VMs (PaaS).
- Azure Container Apps: similar, but with built-in load balancing and scaling (PaaS).
- Azure Kubernetes Service (AKS): an orchestration service that manages the life cycle of many containers.
Containers fit microservices well: You split an application into small, independent parts that can be changed and scaled separately.
Azure Functions
Azure Functions is event-driven serverless compute. An event, such as a request, a timer or a message, wakes the function. Afterward Azure releases the resources again. You pay only for the compute time in which the function runs, and the function scales automatically as needed. That fits when you want to care only about the code and the work is done quickly, in seconds or less.
Hosting applications
For web applications there is Azure App Service besides VMs and containers. It hosts web apps, API apps, WebJobs and mobile apps in the programming language of your choice, without you managing infrastructure. It scales automatically and offers high availability. Microsoft describes a scale: With VMs you have the most control, with App Service the least operational effort, and containers lie in between.
Comparison
| Option | Control | You take care of | Fits |
|---|---|---|---|
| Virtual machine | highest | operating system, updates, software | your own software, lift and shift |
| Containers | medium | containers and application | microservices, fast scaling |
| App Service | low | only the application | web apps and APIs |
| Azure Functions | lowest | only the code | short, event-driven tasks |
An example
The made-up company "Bäckerei Vogel" takes pre-orders online. The order website runs in App Service, because it is an ordinary web app. When an order comes in, an Azure Function sends a confirmation email. It runs only when an order comes in. The bakery's inventory system is old Windows software that can't be rebuilt. It runs unchanged on a VM.
Exercise 1
Choose a compute option for each scenario and justify it in one sentence:
- A property management company wants to bring its old management software, which demands a specific operating system, into the cloud without rebuilding it.
- An online shop is to grow automatically from a few to many identical servers during promotions.
- A company wants to run a small task every night that takes a few seconds.
- A tax firm wants to give 30 employees at changing locations the same Windows desktops.
Solution 1
- Virtual machine. The software needs a specific operating system and is not to be rebuilt. That is lift and shift onto IaaS, with full control over the system.
- Virtual Machine Scale Set. It manages identical, load-balanced VMs and can raise and lower their number automatically as needed. If the shop doesn't have to stay on a VM, App Service with automatic scaling would also be possible.
- Azure Functions. A timer triggers the function, it runs for seconds, and you pay only for the compute time.
- Azure Virtual Desktop. It delivers centrally managed Windows desktops for distributed users, signed in through Microsoft Entra ID.
For task 2 there are two defensible answers. What matters is the justification: Whoever chooses a group of VMs keeps control over the operating system, whoever chooses App Service gives it up for less operational effort.