🔒 Guided

Pre-launch preview. Authorised access only.

Incorrect code

Guided by A Guide to Cloud
Explore AB-900 AI-901
Guided AZ-140 Domain 1
Domain 1 — Module 12 of 12 100%
12 of 28 overall

AZ-140 Study Guide

Domain 1: Plan and Implement an AVD Infrastructure

  • AVD Architecture: The Big Picture Free
  • Network Capacity and Design Free
  • RDP Shortpath, Multipath and QoS Free
  • Private Link and Network Troubleshooting Free
  • Storage Planning for User Data Free
  • File Shares and Azure NetApp Files Free
  • Host Pool Architecture: Personal vs Pooled Free
  • Sizing for Performance and Capacity Free
  • Creating Host Pools and Session Hosts Free
  • Session Host Licensing Free
  • Building Session Host Images Free
  • Image Lifecycle and Compute Gallery Free

Domain 2: Plan and Implement Identity and Security

  • Identity Scenarios for AVD
  • RBAC, Conditional Access and SSO
  • Defending AVD with Microsoft Defender
  • Network Security: NSGs, Firewall, Bastion
  • Threat Protection and Confidential VMs

Domain 3: Plan and Implement User Environments and Apps

  • FSLogix Profile Containers and ODFC
  • FSLogix Cloud Cache and Application Masking
  • AVD Clients: Choose and Deploy
  • User Experience and Session Settings
  • Application Groups and RemoteApp
  • Microsoft 365, Teams and OneDrive on AVD
  • App Attach: Dynamic Application Delivery

Domain 4: Monitor and Maintain an AVD Infrastructure

  • Monitoring AVD with Azure Monitor
  • Autoscaling and Session Management
  • Update Strategy and Backups
  • Disaster Recovery and Multi-Region

AZ-140 Study Guide

Domain 1: Plan and Implement an AVD Infrastructure

  • AVD Architecture: The Big Picture Free
  • Network Capacity and Design Free
  • RDP Shortpath, Multipath and QoS Free
  • Private Link and Network Troubleshooting Free
  • Storage Planning for User Data Free
  • File Shares and Azure NetApp Files Free
  • Host Pool Architecture: Personal vs Pooled Free
  • Sizing for Performance and Capacity Free
  • Creating Host Pools and Session Hosts Free
  • Session Host Licensing Free
  • Building Session Host Images Free
  • Image Lifecycle and Compute Gallery Free

Domain 2: Plan and Implement Identity and Security

  • Identity Scenarios for AVD
  • RBAC, Conditional Access and SSO
  • Defending AVD with Microsoft Defender
  • Network Security: NSGs, Firewall, Bastion
  • Threat Protection and Confidential VMs

Domain 3: Plan and Implement User Environments and Apps

  • FSLogix Profile Containers and ODFC
  • FSLogix Cloud Cache and Application Masking
  • AVD Clients: Choose and Deploy
  • User Experience and Session Settings
  • Application Groups and RemoteApp
  • Microsoft 365, Teams and OneDrive on AVD
  • App Attach: Dynamic Application Delivery

Domain 4: Monitor and Maintain an AVD Infrastructure

  • Monitoring AVD with Azure Monitor
  • Autoscaling and Session Management
  • Update Strategy and Backups
  • Disaster Recovery and Multi-Region
Domain 1: Plan and Implement an AVD Infrastructure Free ⏱ ~13 min read

Image Lifecycle and Compute Gallery

Plan and implement image lifecycle management — versioning, multi-region replication, testing with validation pools, and production-grade image pipelines using Azure Compute Gallery.

The image lifecycle

☕ Simple explanation

Think of image management like a bakery production line.

Every month, you bake a fresh batch of bread (build a new image). Before selling it to customers, a taste tester tries it (validation host pool). If it is good, it goes on the shelves (production). Last month’s bread gets moved to the clearance rack (deprecated). Very old bread gets thrown out (deleted).

You also ship bread to multiple stores (regions). Each store keeps a few loaves on the shelf — you do not bake separately for each store, you replicate from the main bakery.

Image lifecycle management is the practice of building, testing, distributing, deploying, and eventually retiring session host images in a controlled, repeatable way. In production AVD environments, you do not patch running session hosts — you build a new image with updates baked in, test it, deploy new session hosts from it, and drain the old ones.

Azure Compute Gallery (formerly Shared Image Gallery) is the platform service that supports this lifecycle. It provides versioned image storage, multi-region replication, and integration with VM Image Builder for automated pipelines.

The five stages of image lifecycle

Every image goes through these stages:

StageWhat happensWho is involved
BuildCreate a new image version — install apps, apply patches, optimise settingsImage Builder or manual process
TestDeploy the image to a validation host pool, verify apps and performanceIT team, pilot users
DistributeReplicate the image version to all required Azure regionsAzure Compute Gallery handles replication
DeployCreate new session hosts from the tested image, drain old session hostsAutomation pipeline or admin
DeprecateMark old image versions as end-of-life, eventually delete themGallery version management

🏢 Raj at TerraStack: “We run this cycle monthly. Image Builder creates the new version on the second Wednesday (Patch Tuesday). Thursday it deploys to our validation pool. Friday, Andrea’s EA and two power users test it. Monday, we roll it to production if it passes. Old image versions get deprecated after 90 days.”

Update strategy — bake, don’t patch

The recommended approach for AVD session host updates is image replacement, not in-place patching:

  1. Build a new image version with the latest OS patches and app updates baked in.
  2. Deploy new session hosts from the new image to the host pool.
  3. Drain old session hosts — set them to drain mode so no new sessions land on them.
  4. Remove old session hosts once all users have logged off.

This approach ensures every session host is identical and eliminates configuration drift (where VMs gradually become different because patches apply inconsistently).

ℹ️ When in-place patching makes sense

Image replacement is the gold standard, but in-place patching (Windows Update, WSUS, Intune) is sometimes used for:

  • Personal host pools: Each user has a dedicated VM with personalised settings — replacing it would lose their customisations.
  • Emergency security patches: A critical zero-day that cannot wait for the next image build cycle.
  • Small deployments: A pool with 2-3 session hosts where image pipelines are overkill.

For pooled host pools at any meaningful scale, image replacement is always preferred.

Azure Compute Gallery — the image warehouse

Azure Compute Gallery organises your images in a three-level hierarchy:

Gallery

The top-level container. Typically you create one gallery per team or environment (e.g. gal_avd_production, gal_avd_dev). A gallery lives in a resource group and a region, but the images inside it can be replicated to other regions.

Image definition

A logical grouping within a gallery. An image definition describes the category of image — not a specific version. It includes metadata like:

  • OS type: Windows or Linux
  • OS state: Generalised (Sysprep’d) or Specialised
  • Publisher, offer, SKU: Descriptive metadata (e.g. publisher: “TerraStack”, offer: “AVD”, SKU: “Win11-MultiSession-M365”)
  • Recommended VM sizes: Guidance for consumers (not enforced)

Think of it as a product listing — “Windows 11 multi-session with Office” — without specifying which month’s build.

Image version

A specific build of an image definition. Each version has a version number (e.g. 1.0.0, 1.1.0, 2025.06.01) and contains the actual VM disk(s). This is what you deploy session hosts from.

Hierarchy summary: Gallery contains Image Definitions. Image Definitions contain Image Versions. You deploy VMs from a specific Image Version.

Managed Image vs Azure Compute Gallery
AspectManaged Image (Legacy)Azure Compute Gallery
VersioningNo — single image, no historyYes — multiple versions per definition with version numbers
Multi-region replicationNo — must manually copy to other regionsYes — define target regions and Azure replicates automatically
Simultaneous deploymentsLimited to 20 VMs at onceUp to 1,000 VMs at once (with sufficient replicas)
OrganisationFlat — one image resource per captureHierarchical — gallery, definitions, versions
SharingSame subscription onlyShare across subscriptions, tenants, or publicly via community gallery
Lifecycle managementManual deletionEnd-of-life dates, exclude from latest, auto-deprecation
RecommendationAvoid for new deploymentsUse for all production AVD images

Image replication across regions

When you create an image version in a Compute Gallery, you specify target regions and the number of replicas per region. Azure copies the image to each target region.

Key rules for replication:

  • Always include the source region as a target — this is required.
  • More replicas means more simultaneous deployments — each replica supports about 20 concurrent VM creations. If you deploy 100 session hosts at once, you need at least 5 replicas in that region.
  • Replication takes time — a large image may take 30-60 minutes to replicate to distant regions. Plan for this in your pipeline.
  • Storage cost — you pay for storage in each target region. Keep replica counts reasonable.

🏢 Raj’s multi-region setup: “TerraStack has offices in Sydney and Auckland. Our gallery replicates every image version to Australia East and New Zealand North with 3 replicas each. Session hosts in both regions deploy from a local copy — no cross-region traffic and fast provisioning.”

Version management best practices

As you build new images monthly, the gallery accumulates versions. Here is how to manage them:

Keep N versions, deprecate the rest

Set an end-of-life date on old image versions. After the end-of-life date, the version cannot be used to create new VMs (but existing VMs are unaffected). A typical policy: keep the current version and two previous versions, set end-of-life on anything older.

Exclude from latest

Each image definition has a concept of “latest” — when a consumer deploys without specifying a version number, they get the latest. You can set exclude from latest on a version to prevent it from being picked up automatically. This is useful for:

  • Images still being tested (not yet promoted to production)
  • Hotfix images that should not become the new default

Naming conventions

Use a date-based versioning scheme for clarity:

  • 2025.06.01 — June 2025 monthly build, first revision
  • 2025.06.02 — June 2025, second revision (hotfix)

This makes it obvious which image is current and when it was built.

💡 Exam tip: Gallery replication and deployment scale

The exam tests whether you understand the relationship between replicas and deployment scale. If a question says “you need to deploy 200 session hosts simultaneously from a gallery image,” you need to calculate: 200 VMs / 20 per replica = 10 replicas in that region. If you only have 2 replicas, deployments will be throttled and slow.

Testing images with validation host pools

Before rolling a new image to production, deploy it to a validation host pool — a small pool designated for testing:

  1. Build the new image version.
  2. Deploy 1-2 session hosts to the validation pool from the new image.
  3. Have pilot users (or your IT team) log in and test critical applications.
  4. Verify printing, audio, clipboard, profile loading, and line-of-business apps.
  5. If tests pass, promote the image to production pools.
  6. If tests fail, investigate and build a corrected image — do not push to production.

🏛️ JC at the Federal Department: “Director Walsh mandates that every image goes through our validation pool. Aisha’s security team runs compliance scans, and three staff members test the approved software list. Nothing goes to production without sign-off. It adds a day to the cycle, but it has saved us from two broken patches this year.”

Replacing session hosts with a new image

Once an image passes validation, here is the production rollout:

  1. Deploy new session hosts from the new image version into the production host pool.
  2. Drain old session hosts — set Allow new sessions to No.
  3. Wait for users to log off — or send a notification with a deadline.
  4. Remove old session hosts — delete the VMs, their disks, and NICs.
  5. Verify — confirm the pool is healthy with all new session hosts available.

This can be fully automated with PowerShell scripts or Azure DevOps pipelines. The key is to never delete old hosts before new ones are confirmed healthy.

Image optimisation

Before finalising an image, optimise it for VDI performance:

OptimisationWhat to doWhy
Disable unnecessary servicesTurn off services like Print Spooler (if not needed), Xbox services, Consumer ExperienceReduces CPU and memory footprint per session
Remove bloatwareUninstall built-in apps users do not need (Solitaire, Tips, etc.)Smaller image size, fewer updates, cleaner UX
Disable scheduled tasksTurn off tasks that run per-user and waste resources in multi-sessionReduces background CPU usage
Optimise visual effectsReduce animations, transparency, and visual effectsImproves responsiveness on bandwidth-limited connections
Configure Windows UpdateDisable auto-update on session hosts (updates come via new images)Prevents unexpected reboots and bandwidth spikes

Microsoft provides the Virtual Desktop Optimisation Tool (on GitHub) that applies many of these optimisations automatically.

ℹ️ Deep dive: The VDI Optimisation Tool

The Virtual Desktop Optimisation Tool is an open-source PowerShell script collection from Microsoft that disables unnecessary services, removes built-in apps, and configures Windows for optimal multi-session performance. You run it as a customisation step during image creation — either manually or as an Image Builder PowerShell step.

The tool is configurable — you can choose which optimisations to apply based on your environment. For example, if your users need the Microsoft Store, you can skip that optimisation.

Always test optimised images thoroughly. Aggressive optimisations can break applications that depend on disabled services.

Question

What are the three levels of Azure Compute Gallery hierarchy?

Click or press Enter to reveal answer

Answer

Gallery (top-level container) contains Image Definitions (logical grouping with metadata like OS type and state). Image Definitions contain Image Versions (specific builds with version numbers and actual disk data). You deploy VMs from a specific Image Version.

Click to flip back

Question

How do you calculate the number of replicas needed in a region?

Click or press Enter to reveal answer

Answer

Each replica supports approximately 20 simultaneous VM deployments. Divide the number of VMs you need to deploy at once by 20. For example, deploying 100 VMs at once requires at least 5 replicas in that region.

Click to flip back

Question

What does 'exclude from latest' do on a gallery image version?

Click or press Enter to reveal answer

Answer

It prevents that version from being selected when a consumer deploys without specifying a version number. Useful for images still being tested or hotfix versions that should not become the automatic default.

Click to flip back

Question

What is the recommended update strategy for pooled AVD session hosts?

Click or press Enter to reveal answer

Answer

Image replacement — build a new image version with updates baked in, deploy new session hosts from it, drain old session hosts, and remove them once empty. This prevents configuration drift and ensures every host is identical.

Click to flip back

Question

What is the Virtual Desktop Optimisation Tool?

Click or press Enter to reveal answer

Answer

An open-source PowerShell tool from Microsoft that optimises Windows for multi-session VDI by disabling unnecessary services, removing built-in apps, and configuring performance settings. Run it during image creation as a customisation step.

Click to flip back

Knowledge Check

Raj needs to deploy 200 session hosts simultaneously in Australia East from a Compute Gallery image. The gallery currently has 2 replicas in that region. What should Raj do?

Knowledge Check

JC's team builds a new image version every month. They want to keep the last three versions available and prevent older versions from being used for new VMs. What should they configure?

Knowledge Check

Which of the following are valid reasons to use in-place patching instead of image replacement for AVD session hosts? (Choose two)

🎬 Video coming soon

Image Lifecycle and Compute Gallery


Next up: Identity Scenarios for AVD — moving into Domain 2, we explore Microsoft Entra ID join, hybrid join, and Active Directory Domain Services for AVD session hosts and how identity choices affect your architecture.

← Previous

Building Session Host Images

Next →

Identity Scenarios for AVD

Guided

I learn, I simplify, I share.

A Guide to Cloud YouTube Feedback

© 2026 Sutheesh. All rights reserved.

Guided is an independent study resource and is not affiliated with, endorsed by, or officially connected to Microsoft. Microsoft, Azure, and related trademarks are property of Microsoft Corporation. Always verify information against Microsoft Learn.