Azure Compute & Networking Services Explained
Azure compute and networking services are the building blocks you use to run applications and connect them. On the compute side, you choose how much of the stack you want to manage: virtual machines give you a full computer to control, containers package an application so it runs the same way anywhere, and Azure Functions run small pieces of code on demand without any servers for you to manage. On the networking side, Azure Virtual Networks give your resources a private space to communicate, subnets divide that space, and peering links networks together. To reach Azure from your own offices you can use a VPN Gateway over the internet or ExpressRoute over a private connection. For AZ-900 you need to recognize what each service is for and match it to a described need, not configure it. This lesson compares the main compute options and the main ways to connect to an Azure network.
On this page8 sections
- The compute choices at a glance
- Virtual machines (IaaS)
- Containers: Azure Container Instances and Kubernetes Service
- Azure Functions (serverless)
- Scaling and keeping VMs available
- Application hosting with Azure App Service
- Virtual networks, subnets, and peering
- Connecting to Azure: VPN Gateway vs ExpressRoute
- Compare virtual machines, containers, and Azure Functions and choose the right compute type for a scenario.
- Describe Azure Virtual Machine Scale Sets and availability sets and how each improves availability.
- Explain the purpose of Azure App Service for hosting web applications and APIs.
- Describe how Azure Virtual Networks, subnets, and peering connect resources privately.
- Distinguish Azure VPN Gateway from Azure ExpressRoute for connecting on-premises networks to Azure.
The compute choices at a glance
Azure compute is any service that runs your code or applications, and Azure gives you several options that differ mainly in how much you manage yourself. At one end are virtual machines: you get a complete computer in the cloud and are responsible for the operating system and software on it, which is the infrastructure-as-a-service model. In the middle are containers, which package an application together with everything it needs so it starts quickly and runs the same way on any host. At the other end are Azure Functions, a serverless option where you supply only small pieces of code and Azure runs them on demand — you never think about servers at all.
The right choice is a trade-off between control and convenience: more control means more responsibility, while more convenience means Azure handles more for you. A useful way to picture it is a sliding scale from a virtual machine (most control, most management) to a function (least management, least control), with containers in between. The sections that follow describe each option, then a table sums up when to reach for which.
Virtual machines (IaaS)
An Azure Virtual Machine is a computer you run in the cloud — it has an operating system, memory, and storage, just like a physical server, but Microsoft supplies the underlying hardware. Virtual machines are the classic example of infrastructure as a service: Azure manages the physical host and datacenter, while you manage the operating system, patches, and any software you install. This gives you the most control of any compute option, which makes VMs the right pick when you need to run specific software, use a custom configuration, or move an existing server to the cloud without redesigning it — often called lift and shift.
Because you manage the software, you also carry more responsibility for keeping it updated and secure. A virtual machine needs a few supporting resources to work: a disk for storage, a virtual network and network interface to connect it, and usually a public or private IP address. For example, a team that has an older application built for Windows Server can create a Windows virtual machine in Azure and run the application there almost unchanged. You can create a single VM or many, and you pay for the compute time you use.
Containers: Azure Container Instances and Kubernetes Service
A container packages an application together with its code, settings, and dependencies into a single unit that starts fast and runs the same way on any host. Because a container carries everything the app needs, you avoid the it-works-on-my-machine problem and can move the app between environments easily. Containers are more lightweight than virtual machines because many containers share one operating system instead of each running its own, so you can pack more onto the same hardware.
Azure offers two main services for containers. Azure Container Instances is the simplest way to run a single container quickly, without managing any servers — good for a small job or a straightforward workload. Azure Kubernetes Service is for running many containers together at scale; it handles orchestration, meaning it schedules containers across machines, restarts failed ones, and scales them up or down. For example, a business that splits its application into several small services might package each one as a container and run them all on Azure Kubernetes Service. For AZ-900, remember that containers are about portability and efficiency, Azure Container Instances is the quick single-container option, and Azure Kubernetes Service manages containers at scale.
Azure Functions (serverless)
Azure Functions is a serverless compute service: you write a small piece of code that does one job, and Azure runs it only when a trigger fires — such as a file being uploaded, a message arriving, or a timer going off. Serverless means you never provision or manage servers, and Azure automatically scales the function to match demand. Crucially, you pay only when your code runs — this is pay-per-execution — so an idle function costs little or nothing. That makes Functions ideal for short, event-driven tasks like resizing an image after upload, processing form submissions, or running a scheduled cleanup. It is a poor fit for long-running or always-on workloads.
Here is how the three compute types compare:
| Compute type | You manage | Best for |
|---|---|---|
| Virtual machines | Operating system and software | Full control, custom setups, lift and shift |
| Containers | The app and its container | Portable apps, microservices, efficient use of hosts |
| Azure Functions | Only your code | Short, event-driven tasks billed per execution |
Read it as a scale of responsibility: a virtual machine gives the most control, a function the least management. For example, choose Functions to run a few seconds of code each time a photo is uploaded, rather than keeping a whole virtual machine running all day.
Scaling and keeping VMs available
Azure has several options that help virtual machines stay available and handle changing load. A Virtual Machine Scale Set lets you run a group of identical virtual machines that automatically increase or decrease in number based on demand — this is autoscaling. When traffic rises, the scale set adds more identical VMs; when it falls, it removes them, so you match capacity to need without manual work.
An availability set is a different tool: it spreads a group of virtual machines across separate underlying hardware inside a datacenter so that a hardware fault or planned maintenance does not take all of them down at once, improving reliability. The two solve different problems — scale sets are mainly about scaling to demand, while availability sets are about keeping VMs running through localized failures.
Azure Virtual Desktop is another VM-based service, but for people rather than servers: it delivers a full Windows desktop and apps from Azure that users can reach from anywhere, which is useful for remote or contract staff. For example, an online store might put its web servers in a scale set so extra VMs appear automatically during a sale, then disappear when the rush ends.
Application hosting with Azure App Service
Azure App Service is a platform-as-a-service option for hosting web applications, REST APIs, and mobile back ends without managing the underlying servers. Instead of creating a virtual machine, installing a web server, and maintaining the operating system yourself, you hand your application code to App Service and Azure runs it for you — patching, load balancing, and scaling are handled by the platform. This makes App Service a fast way to get a website or API online, and a good example of trading some control for a lot of convenience.
It supports common programming languages and can scale out to handle more traffic, either automatically or on a schedule. Because Azure manages the servers, you spend your time on the application rather than on infrastructure. For example, a small team that wants to publish a company website or a customer-facing API can deploy it straight to Azure App Service and let Azure keep the servers patched and available, rather than building and maintaining their own virtual machines. App Service is often the simplest choice when your goal is simply to host a standard web app or API in the cloud.
Virtual networks, subnets, and peering
An Azure Virtual Network, usually called a VNet, is your own private network inside Azure. It gives your Azure resources — such as virtual machines — a space where they can communicate securely with each other, with the internet when you allow it, and with your own on-premises networks. A VNet works much like a traditional network in your office, but it is defined in software.
You divide a VNet into subnets, which are smaller ranges within the network. Subnets let you organize and separate resources — for example, placing front-end web servers in one subnet and back-end databases in another — so you can apply different rules to each. Virtual network peering connects two VNets so that resources in them can communicate as if they were on the same network, using Microsoft's backbone rather than the public internet. Peering is how you link networks together, for instance joining a VNet in one region to a VNet in another.
Azure DNS is a related service that hosts your domain names in Azure so that names can be translated into the addresses resources use. Together, VNets, subnets, and peering give your cloud resources private, organized connectivity.
Connecting to Azure: VPN Gateway vs ExpressRoute
When you need to connect your own datacenter or office to Azure, you have two main choices. Azure VPN Gateway creates an encrypted tunnel between your network and an Azure virtual network over the public internet. It is a site-to-site connection: traffic is protected by encryption, but it still travels across the shared internet, so performance can vary. VPN Gateway is a cost-effective way to link an office to Azure for everyday use.
Azure ExpressRoute instead gives you a private, dedicated connection between your network and Azure that does not go over the public internet at all. Because it is private, ExpressRoute offers more consistent performance, higher reliability, and greater security, which suits large organizations moving a lot of data or with strict requirements. Here is the classic comparison:
| Feature | VPN Gateway | ExpressRoute |
|---|---|---|
| Connection path | Encrypted tunnel over the public internet | Private, dedicated connection, not over the internet |
| Performance | Varies with internet conditions | Consistent and predictable |
| Typical use | Cost-effective office-to-Azure link | High-volume or sensitive enterprise connectivity |
For example, a small branch office might use a VPN Gateway, while a bank moving large workloads would choose ExpressRoute. The exam trigger to remember: a private dedicated connection not over the internet is ExpressRoute.
Tip. Most questions describe a need and ask which service fits. Serverless, pay per execution points to Azure Functions; autoscaling identical virtual machines is a Virtual Machine Scale Set; and a private dedicated connection not over the internet is Azure ExpressRoute. Know that a VPN Gateway is the encrypted-over-the-internet alternative to ExpressRoute, that a virtual network is your private network in Azure, and that Azure Kubernetes Service orchestrates many containers while Azure Container Instances runs a single one.
- Compute options trade control for convenience: virtual machines give the most control, containers add portability, and Azure Functions need the least management.
- Azure Functions is serverless and event-driven, and you pay per execution, so idle code costs almost nothing.
- Azure Container Instances runs a single container quickly; Azure Kubernetes Service orchestrates many containers at scale.
- Virtual Machine Scale Sets run identical VMs that autoscale with demand; availability sets spread VMs across hardware for reliability.
- Azure App Service is a platform-as-a-service option for hosting web apps and APIs without managing servers.
- An Azure Virtual Network (VNet) is your private network in Azure; subnets divide it and peering connects VNets together.
- VPN Gateway connects your network to Azure with encryption over the public internet; ExpressRoute uses a private, dedicated connection that does not use the internet.
Frequently asked questions
What is the difference between virtual machines, containers, and Azure Functions?
Virtual machines give you a full computer and the most control, so you manage the operating system. Containers package an app to run the same way anywhere and are lightweight. Azure Functions is serverless: you supply only code, Azure runs it on demand, and you pay per execution.
When should you use Azure Functions?
Use Azure Functions for short, event-driven tasks that run in response to a trigger, such as processing a file after upload or running a scheduled job. Because it is serverless and billed per execution, it suits work that is occasional rather than always-on, long-running workloads.
What is the difference between Azure VPN Gateway and ExpressRoute?
VPN Gateway connects your network to Azure through an encrypted tunnel that travels over the public internet, which is cost-effective but variable. ExpressRoute provides a private, dedicated connection that does not use the public internet, giving more consistent performance, reliability, and security.
What do Azure Virtual Machine Scale Sets do?
A Virtual Machine Scale Set runs a group of identical virtual machines that automatically scale in or out with demand. When load rises the set adds VMs, and when load falls it removes them, so capacity matches need without manual effort.
What is an Azure Virtual Network?
An Azure Virtual Network, or VNet, is your own private network in Azure where resources such as virtual machines communicate securely. You divide it into subnets to separate resources, and you use peering to connect one VNet to another.
Sign up free to mark lessons complete, bookmark topics and track your exam readiness.