Skip to content

Latest commit

 

History

History
1462 lines (1239 loc) · 105 KB

ROADMAP.md

File metadata and controls

1462 lines (1239 loc) · 105 KB

Linux Broker for AVD: roadmap

This document records the improvements planned for the Linux Broker for AVD Access solution after the Phase 1 correctness, access-control and performance work. It is written so that each item can be picked up on its own, without re-deriving the analysis behind it.

Each item states why it matters, the proposed design across the database, the Broker API, the host agents and the portal, what it depends on, the open questions, and what "done" means. Code references point at the files that motivated each item.

Status Meaning
Planned Designed here, not started
In progress Being implemented
Done Merged

Contents

Constraints every item must respect

These are properties of the current design. A change that breaks one of them needs an explicit decision, not an accident.

  • Stored procedures are the data contract. Schema and procedure changes go in new, numbered, rerunnable files under sql_queries/. Never edit an already-applied file. The bootstrap (deploy/Initialize-Database.ps1) applies every file in name order and rewrites CREATE PROCEDURE to CREATE OR ALTER PROCEDURE, so a redefinition must come after the script that adds any column it references (see 033_alter_procedure-GetVms.sql).
  • Rolling upgrades. The API, portal, task function and Linux host scripts are updated at different times. Migrate-LinuxHostReleaseAgent.ps1 updates existing hosts separately. Every API change must tolerate hosts running the previous scripts, and every procedure change must keep working for the previous API build.
  • No CDN at runtime. The portal must render in Government, sovereign and air-gapped clouds. Everything is bundled, fonts are the system stack, and icons are inline SVG (see front_end/README.md). Chart libraries are fine if Vite bundles them.
  • Sovereign clouds. Every endpoint comes from config.py cloud profiles or explicit settings. Don't hard-code *.microsoft.com hosts. Air-gapped hosts download their scripts from scriptSourceRoot.
  • Pull converges, push accelerates. Hosts fetch their settings on every reconcile run, and the API's SSH push is only a fast path. New host-facing features should follow the same model, so a host that was off or unreachable converges on its own.
  • Validate at every layer. Host settings are bounded by SQL CHECK constraints, API validation, and apply-host-settings.sh clamps, and all three must agree. Apply the same discipline to new settings.
  • The error envelope never leaks internals. Every error is {"error": "<curated message>"}. Exceptions go to Application Insights, never into a response body.

Phase 1: correctness, access control and performance

Status: Done. Summary of what it changed:

Area Change
Scaling actually runs Live bug: TriggerScalingLogic returned PoweredOn/PoweredOff, but the API checked for PowerOn/PowerOff, so scaling only flipped database flags and never started or stopped a VM in Azure. Fixed. Scaling is active immediately after the upgrade.
Scaling correctness A deterministic single active rule, serialized with an application lock. MinVMs ≥ 1 is enforced, including recovery from zero running VMs. Released hosts count as in use. Booting hosts count as pending capacity and are never stopped. Maintenance, assigned and cleanup-pending hosts are never touched. Power state is reconciled from Azure before each run. Requested and failed operations are logged.
Stop mode Power-off stays the default. Admins can choose Deallocate per scaling rule in the portal, with the cost, start-latency and capacity risks explained and confirmed before saving.
Released-VM sweep ReturnReleasedVms honors GracePeriodSeconds plus a reconcile buffer, measured from a dedicated ReleasedDate, instead of a hard-coded 30 minutes from LastUpdateDate.
Cleanup before reuse A returned host is CleanupPending until the previous user's account and mount are really gone. Checkout never picks a pending host, cleanup is retried automatically, and manage-lease.sh keeps the lease while a user is still signed in.
Session resume (opt-in) The host agent used to kill the desktop the moment a user disconnected, so "resume within the grace period" only returned the same VM and profile. The new Host Setting Keep sessions alive during the grace period (off by default) preserves the session until grace expires, which also makes idle disconnects resumable.
Host readiness The connectivity probe runs every 2 minutes in parallel, through a narrow network-status endpoint, and only writes changes.
API throughput Gunicorn workers, threads and timeouts, with a DB concurrency limit sized for the SQL tier (new sqlDatabaseSkuName parameter). JWKS and Graph tokens are cached, every outbound call has a timeout, the group check is skipped when a role already authorizes, the SSH key is cached, and UIDs come from a SQL sequence.
Checkout One SSH session instead of six to eight. create-user.sh --password-stdin handles the groups and the password, with a fallback for hosts running the older script.
Apply Now Parallel, bounded, and deadline-limited. Hosts it doesn't reach converge on their next reconcile.
Access control Reader, Operator and Admin (FullAccess) roles are enforced in the API. The bare access_as_user scope no longer grants access, except through the temporary ALLOW_LEGACY_SCOPE_ACCESS toggle. The portal is role-aware and never receives Linux passwords. Raw "Update attributes" is Admin-only. Operators get Maintenance on/off and Retry cleanup.
Checkout when the pool is full CheckoutVm rolled back the database driver's own transaction when no host was free, so SQL Server raised error 266 and the API answered 500 instead of 409. Fixed in 042.
Rollout The schema is migrated before new images start. Apps restart in the order API → task → front end.
Tests SQL contract tests against SQL Server 2022 with READ_COMMITTED_SNAPSHOT on, Broker API tests against that database through the real driver (api/tests_integration), host script tests in an Ubuntu container, and task function tests, all in CI.

Schema and procedure changes are sql_queries/040–066; see sql_queries/README.md.


Phase 2: admin console

The portal today is a well-built view over the broker's tables. Phase 2 turns it into an operations console: it shows live state, offers actions that change the real world, and answers "who did what".

Status: Done. Every item has shipped. Each has a Shipped note on where it differs from the design below it.

2.1 Real host actions and drain

Status: Done · depends on Phase 1 (roles, stop mode, power sync, CleanupPending)

Shipped. sql_queries/072–082 and 087, the start, stop, restart, drain, undrain and sync endpoints, and the portal's Host menu and grouped host actions. Where it differs from the design below:

  • Stopping an assigned host ends the assignment first, as a return does, so the user gets a running host when they reconnect instead of the stopped one. Restart keeps the assignment. If Azure refuses the stop, the assignment is given back along with the power state.
  • Stop and restart of an assigned host both need Admin plus the hostname typed to confirm. The procedure re-checks the assignment, so a race cannot slip past the check.
  • Drain has no deadline. An operator can sign the user out (2.3), and a maintenance run can set a deadline after a warning (2.9).
  • Scaling leaves draining hosts out of capacity entirely, so a drained pool starts replacements within MaxVMs rather than looking healthy.
  • Drain and Return to service replace the Phase 1 maintenance toggle in the portal. The maintenance endpoint stays for compatibility and now clears the drain flag.
  • No broadcast before a restart. An operator can message the host's sessions first (2.10).

Why. "Update attributes" (front_end/web/src/pages/vm/UpdateVmAttributes.tsx, sql_queries/017_create_procedure-UpdateVmAttributes.sql) edits PowerState, NetworkStatus and VmStatus directly in SQL. Setting Power to On doesn't start the VM. Phase 1 makes it an Admin-only repair tool that keeps the lifecycle invariants, and gives Operators a safe Maintenance toggle for unassigned hosts. What's still missing is taking an assigned host out of rotation without stranding its user, plus real power actions.

Design.

  • API: POST /api/vms/<vmid>/start, /stop (uses the rule's stop mode, or an explicit {"mode": "Deallocate"}), /restart, /drain, /undrain, and POST /api/vms/sync, which runs the Phase 1 Azure power-state sync on demand. Operator role; stop on a checked-out host needs Admin plus confirmation.
  • Drain semantics: add a DrainRequested flag rather than a new VmStatus, so the existing lifecycle states and CHECK constraint stay untouched.
    • CheckoutVm skips flagged hosts for new users, but lets the existing user reconnect.
    • When the assignment ends, the Phase 1 cleanup-pending completion moves the host to Maintenance instead of Available.
    • The scaler never powers off a draining host that still has a user.
  • The Phase 1 "Update attributes" data-repair tool stays Admin-only and gains an explicit warning banner in the portal.
  • UI: an action menu on the host list and details page: Start, Stop, Restart, Drain, Return to service. Each confirm dialog names the host and its current user.

Open questions. Should Restart on a host with a user send a broadcast warning first (see 2.10)? Should Drain have a deadline after which the user is signed out?

Done when. No admin workflow needs "Update attributes". Draining a host never strands an account or mount. Every action is written to the audit log (2.4).

2.2 Host heartbeat and fleet health

Status: Done · no dependencies

Shipped. sql_queries/083–086, the heartbeat and /api/hosts/health endpoints, LINUXBROKER_AGENT_VERSION (1.0.0) in every host script, the heartbeat in both release agents, the portal's Fleet health page, a Host agent card on each host, and a dashboard strip. Where it differs from the design below:

  • Report only. The task function does not mark a host Unreachable on a stale heartbeat, and readiness at boot still comes from the TCP probe. Gating readiness on the heartbeat would let a broken heartbeat path take every host out of rotation at once; it can be added later behind a safety valve.
  • No history table. Only the current row per host is kept.
  • The separate settings ack stays. The heartbeat also carries SettingsVersion and records it when it changed, so a failed ack no longer leaves a host showing drift.
  • A Linux host's managed identity names its VM in xms_mirid, so a host cannot post a heartbeat for another hostname.
  • NFS is checked with a bounded stat -f on mounted homes, or, with none mounted, a TCP connection to the NFS server remembered from an earlier mount.

Why. The only thing a host reports today is the settings version it applied (/api/hosts/<hostname>/settings/ack). Answering "which hosts run the old agent", "is NFS mounted", "is xrdp up" or "is this host wedged" means SSHing into each one. Host logs are local files (/var/log/release-session.log, /var/log/createuser.log, /var/log/linuxbroker-host-settings.log).

Design.

  • SQL: dbo.HostHeartbeats holds one current row per host (Hostname, ReceivedAt, AgentVersion, OsId, OsVersion, Desktop, XrdpVersion, XrdpActive, NfsReachable, LoadAverage, MemoryAvailableMb, RootDiskFreePct, SessionsJson). A capped history table is optional. RecordHostHeartbeat upserts it.
  • API: POST /api/hosts/<hostname>/heartbeat (LinuxHost role plus group, the same validation as ack; bounded payload size; unknown keys dropped). GET /api/hosts/health (Reader).
  • Host agent: release-session.sh already inventories sessions on every timer run. It should also collect the fields above and send one heartbeat per run. That call replaces the separate settings ack by carrying SettingsVersion, while keeping the ack for older API builds. An AGENT_VERSION constant goes in every host script, so drift is visible.
  • Portal: a Fleet health page listing each host's last seen time, agent, OS and xrdp versions, NFS status, load and memory, and flags such as "stale > 3 reconcile intervals", "xrdp down", "agent outdated" and "settings drift". Dashboard attention counts come from the same data.
  • The task function can mark a host Unreachable when its heartbeat is stale, even if TCP 22 still answers.

Open questions. How long to keep heartbeat history? Should it double as the readiness signal at boot, replacing the TCP probe?

Done when. An operator can find outdated, wedged or NFS-broken hosts without SSH, and every host reports its agent version.

2.3 Sessions and users

Status: Done · depends on 2.2 (heartbeat carries session state) and Phase 1 roles

Shipped. sql_queries/088–100, the sessions, users and session action endpoints, the allowlisted session-control.sh in host agent 1.1.0, and the portal's Sessions and user pages. Where it differs from the design below:

  • Sign-out ends the desktop through session-control.sh, then the API releases the host itself through the lease-qualified ReleaseVm, so the grace period starts without depending on the agent's one-shot release. "And return the host" also ends the assignment.
  • A profile reset is requested, then applied at the user's next new assignment, on the assigned host, just before create-user.sh mounts the home, instead of renaming the home at once. That removes the race with a concurrent checkout and needs no separate runner host. It is applied only when this is the user's only assignment, no host is still cleaning them up, and no current heartbeat reports them elsewhere; otherwise it stays pending. The request can be cancelled.
  • The old profile is kept as <user>.reset-<UTC timestamp> on the share and never deleted. Removing old profiles is manual (see deploy/DEPLOYMENT.md).
  • The API derives each session's state: active, disconnected, released (grace running), connecting, not connected, cleanup pending, unmanaged and unknown. The dashboard's Attention panel (2.6) flags users who were given a host and never connected.
  • session-control.sh acts only on broker accounts: a UID of at least 1000, a member of tsusers, and never root or avdadmin. A host with an older agent answers 409, naming the migration script, and Migrate-LinuxHostReleaseAgent.ps1 now carries on past a failed or powered-off host.
  • Deferred: a "reconnect to a specific host" override for support cases.

Why. The commonest helpdesk question is "where is this user and why can't they connect?" Today you search the VM list for a username, and nothing shows connected versus disconnected state, when the disconnect happened, how much grace is left, or how long the user has been idle. The host knows all of it (xrdp-who-xorg.sh, disconnected_users.tsv, xprintidle).

Design.

  • Data: the heartbeat's SessionsJson holds, per user, state (active/disconnected/unknown), session start, disconnected-since and idle seconds. SQL joins it with VirtualMachines (Username, LeaseId, ReleasedDate from Phase 1) and VmUsers.
  • API: GET /api/sessions and GET /api/users/<username> (Reader). Actions (Operator):
    • POST /api/sessions/<hostname>/<username>/signout terminates the logind session. The next reconcile releases the host.
    • POST .../message shows a notification in the session (reuses warn_idle_user).
    • POST /api/users/<username>/reset-profile (Admin) renames the NFS home to <name>.reset-<timestamp> so a fresh profile is created at the next checkout. It's only allowed when the user holds no lease.
  • Host: a new allowlisted script, session-control.sh, with validated signout, message and reset-profile verbs. It follows the manage-lease.sh pattern, so the API never needs broader sudo.
  • Portal: a Sessions page with a search box ("find user"), state badges, a grace countdown, idle time, and actions. The user detail view shows the current host and past hosts (from the VirtualMachinesHistory temporal table).

Open questions. Do we need a "reconnect to a specific host" override for support cases? Should profile resets be kept, and for how long?

Done when. A helpdesk Operator can find a user, see why they're stuck, and fix it without SSH or the database.

2.4 Admin audit log

Status: Done · depends on Phase 1 roles (the actor identity)

Shipped. sql_queries/067–071 and 086, the @audited decorator and denial auditing, GET /api/audit, a daily purge from the task function, the portal's Audit page with CSV export, and Version history on Host Settings. Where it differs from the design below:

  • Retention: SQL keeps entries for AUDIT_RETENTION_DAYS (default 365, 30–3650), and every entry is also a structured linuxbroker.api.audit log record in Application Insights, with its own retention.
  • High-volume agent traffic is not audited: AVD checkouts, Linux host releases, acks and heartbeats, and the task's probes. VirtualMachinesHistory already records their effect, and 2.6's checkout events will cover checkouts. Their authorization denials are audited.
  • Broker-initiated entries cover scaling power actions and their failures, power states corrected from Azure, expired releases, completed cleanups and drains, and the purge.
  • DeleteVm now reports a delete of a missing VM as not found, so the audit records what really happened.

Why. Nothing records who deleted, released or returned a host, who changed a scaling rule, or who pushed settings. LinuxHostSettings is temporal and has UpdatedBy, but the portal doesn't show that history.

Design.

  • SQL: dbo.AuditLog (AuditId, OccurredAt, ActorOid, ActorName, ActorType user/service, Action, TargetType, TargetId, Outcome success/failure/denied, DetailJson, CorrelationId) plus a paged reader, following 037–039.
  • API: a single audit(action, target, outcome, detail) helper called by every mutating handler and every authorization denial on a mutating route. The actor comes from the validated token (oid, preferred_username or app ID). A failure to write the audit entry never fails the operation, but it is logged.
  • Portal: an Audit page (Reader) with filters for actor, action, target and date, plus CSV export. The host settings page gains Version history with a field-by-field diff from LinuxHostSettingsHistory.

Open questions. Retention: forever in SQL, or export to Log Analytics after N days?

Done when. Every portal action and every broker-initiated action (scaling, sweep) is attributable.

2.5 Scaling policy and schedules

Status: Done · depends on Phase 1 scaling fixes

Shipped. sql_queries/101–114, the scaling policy, schedule and preview endpoints, and the portal's Scaling policy page, now the first page of the Scaling section. Where it differs from the design below:

  • Windows override the default rule and keep its up/down ratios, rather than copying AVD's phases and capacity threshold. Outside every enabled window the default rule applies. "Add business day windows" creates ramp-up, peak and ramp-down windows from the default rule.
  • One policy time zone for every window (a Windows zone name from sys.time_zone_info, UTC by default), not one per schedule. Windows may run past midnight. Enabled windows may not overlap, which SQL checks under a lock and the API and the editor report, so no contiguity rule is needed.
  • The preview is TriggerScalingLogic itself as a dry run, so it can never disagree with a real run. It can also resolve another time or try proposed values before they are saved.
  • MinVMs wins over MaxVMs: the over-maximum scale-down never takes serviceable hosts below the minimum. Draining and maintenance hosts count toward the maximum, so without this a drain or a maintenance run could make scaling stop ready hosts.
  • Each run waits briefly for the scaling lock instead of skipping, stamps StartRequestedAt on every start (2.6 measures start-to-ready from it), and logs its phase and counts. A manual stop uses the active phase's stop mode.
  • Deferred: a per-phase "force sign-out of idle or disconnected users" for off-peak. The grace and idle timeout host settings already reclaim those sessions fleet-wide.

Why. Phase 1 makes a single rule authoritative. Real pools have daily patterns, and AVD scaling plans solve that with ramp-up, peak, ramp-down and off-peak phases in a named time zone.

Design.

  • SQL: dbo.ScalingSchedules (ScheduleId, Name, TimeZone, DaysOfWeek, StartTime, plus per-phase MinVMs, MaxVMs, ratios, increments, StopMode, and optional "force sign-out idle/disconnected after N minutes" for off-peak). TriggerScalingLogic resolves the active phase with AT TIME ZONE. If no schedule matches, the Phase 1 rule applies.
  • API: CRUD (Admin) plus GET /api/scaling/preview, which runs the decision logic read-only against current counts and returns what the next run would do and why.
  • Portal: replace the rule list with a Scaling policy page: the current phase, a "what happens next" preview, a weekly timeline, and a schedule editor with validation (min < max, up > down, increments ≥ 1, contiguous schedules).

Open questions. Do we copy AVD's "capacity threshold" semantics exactly, or keep the up/down ratios?

Done when. An admin can express business hours versus nights and weekends, and see the effect before saving.

2.6 Dashboard trends and unmet demand

Status: Done · depends on Phase 1 scaling fixes

Shipped. sql_queries/115–123, GET /api/metrics/utilization and /api/metrics/attention, and the dashboard's Capacity, Checkout health and Attention panels. Where it differs from the design below:

  • Checkout outcomes are Assigned, Reused, NoneAvailable, ProvisionFailed and Error. Recording one never fails the checkout.
  • Start-to-ready is measured for every start, by scaling or by hand: the start stamps StartRequestedAt, and SetVmNetworkStatus records the time to the first reachable probe in dbo.HostStartEvents. A restarting host that has not gone down yet keeps its stamp, and stamps older than two hours are ignored.
  • Events are kept for CHECKOUT_EVENT_RETENTION_DAYS (default 90) and purged by the daily audit purge call, so an older task build purges them too.
  • The chart is an inline SVG component with a dash pattern per line, markers for denied checkouts, a pointer readout and a table view. No chart library.
  • The Attention panel also covers hosts stuck in cleanup, users given a host who never connected, hosts a maintenance run could not patch (2.9), and the fleet health flags, grouped. It appears only when something needs an operator.

Why. The dashboard shows point-in-time counts. VmScalingActivityLog already has a row every 5 minutes (running, in use, actions), which is enough for utilization trends. What's missing is unmet demand: users who were told "No Linux host is available" (checkout 409s) aren't recorded anywhere except the API logs.

Design.

  • SQL: dbo.CheckoutEvents (Timestamp, Username, AvdHost, Outcome assigned/reused/none-available/provision-failed, DurationMs, Hostname), written by the checkout handler. A GetUtilizationSeries @From, @To, @Bucket procedure feeds the charts.
  • Portal: 24-hour and 7-day charts of running, in use and max, with markers for denied checkouts, checkout latency percentiles, and time from scale-up to ready. They use an inline-SVG chart component or a small bundled library (no CDN).
  • An Attention panel: hosts unreachable for more than N minutes, settings drift, outdated agents, zero ready hosts, and denied checkouts in the last hour.
  • Align the dashboard's utilization figure with the scaler's definition (Phase 1): in use divided by powered-on, non-maintenance hosts.

Done when. An admin can answer "were we short on capacity this week, and when?"

2.7 Operator-grade host list

Status: Done · depends on 2.1

Shipped. sql_queries/141–143, the paged GET /api/vms, GET /api/vms/import/candidates and POST /api/vms/import, the rebuilt Hosts list, and the Import from Azure page. Where it differs from the design below:

  • The list always pages, filters and sorts on the server, with its view in the URL. The BFF pages the bare list of an older API itself.
  • Status chips also cover Draining and Cleanup pending. The optional columns are IP address, OS, agent, settings, last heartbeat, sessions, VMID and last updated, remembered per browser.
  • The bulk bar also offers Return to service, Send message (2.10) and Start maintenance (2.9, which opens a new run with the hosts chosen). Hosts an action does not apply to are skipped and named, the rest run four at a time, and each host's outcome is reported. Bulk delete needs delete typed.
  • Import needs DNS. A candidate must resolve as <hostname>.<DOMAIN_NAME>, the name every SSH call uses: the API cannot read NICs, and a typed-in IP would let the IP-based probe mark a host ready that every SSH call fails on. Imports go through a new ImportLinuxHostVm rather than RegisterLinuxHostVm, and start Unreachable with Azure's power state, so no one is given a host before the probe confirms it.
  • Test brokering sits in the host list's Admin Tools menu with Import from Azure and Add a host manually.

Design.

  • Row selection with bulk actions: Drain, Start, Stop, Apply settings, Delete (Admin).
  • Status filter chips (Ready, In use, Released, Maintenance, Unreachable, Off), plus auto-refresh like the dashboard.
  • Optional columns: OS, agent version, settings version, last heartbeat, session state.
  • Server-side paging and filtering once pools pass a few hundred hosts. GetVms returns everything today.
  • Import from Azure instead of typing IP addresses: list VMs in the host resource group tagged broker-role=linux-host that aren't registered yet, and register the selected ones through RegisterLinuxHostVm. "Add VM" becomes the manual fallback.
  • Demote Checkout VM from the dashboard's primary action to a "Test brokering" tool (Admin). It never shows credentials; Phase 1 already strips them.

2.8 Navigation and readability

Status: Done · after 2.3, so the new sections exist

Shipped. Every URL is unchanged. Where it differs from the list below:

  • Hosts and Scaling show their pages as tabs under the navigation.

  • Broker timestamps are read as UTC, as Azure SQL stores them, in every format the API returns. History and audit tables also show the absolute time.

  • Shortcuts: / to search, g then a letter to change section, ? for help. They never fire while typing and can be turned off in Profile (WCAG 2.1.4). Compact rows are set in Profile too.

  • Navigation: Overview · Hosts · Sessions · Scaling · Settings · Audit.

  • Hostname-first identifiers. VMID becomes a secondary detail.

  • Relative times ("5 min ago") with an absolute UTC tooltip. Broker timestamps are database-local (UTC on Azure SQL) and currently render without a zone.

  • A compact density toggle for large tables. The glass surfaces stay, but row height shrinks.

  • An inline lifecycle explainer (Available → Checked out → Released → Available) on host pages. Admins confuse Release (the user disconnected, grace running) with Return (end the assignment now).

  • Keyboard shortcuts for search and navigation. Keep the existing accessibility rules (contrast, reduced motion and transparency, no color-only status).

2.9 Rolling maintenance and patching

Status: Done · depends on 2.1 (drain) and 2.2 (health)

Shipped. sql_queries/124–140, the maintenance endpoints, the allowlisted patch-host.sh in host agent 1.1.0, the task's AdvanceMaintenance timer (every minute, task 0.14), and the portal's Maintenance pages. Where it differs from the design below:

  • Patching runs over SSH through patch-host.sh (dnf on RHEL 8 and 9, yum on RHEL 7, apt on Ubuntu; security updates or all), not Azure Update Manager or Run Command. It needs no new Azure permission and works in sovereign and air-gapped clouds. The reboot is the Azure restart the API already has. Restart-only runs work with older agents.
  • Hosts are chosen from a list, with a helper that picks a share of those shown, rather than by a saved filter.
  • A run waits for users by default. Forced sign-out happens only in a run whose admin set a deadline, after a warning message; manual Drain keeps no deadline.
  • Admission shares the scaling lock and takes a ready host only while more than the minimum are ready (the run's override, or the phase's MinVMs). While a ready host waits for a spare, scaling keeps one more host on, never past MaxVMs.
  • Verification needs the host reachable, a heartbeat whose boot time is after the restart, and xrdp active. Each host is put back the way it was found, including stopping one that was off.
  • A failed host stays drained for inspection and appears in the dashboard's Attention panel. A run stops after too many failures and can pause after canary hosts.
  • Returning a host to service by hand is refused while the run is patching, restarting or verifying it; before that, a manual return skips it.

Why. Each host is single-user and has a live session. Patching means waiting for users to leave, which nobody wants to babysit.

Design. A maintenance run (Admin) picks hosts by filter or percentage, then:

  1. Drains them.
  2. Waits until each host has no assignment.
  3. Patches: Azure Update Manager assessment or install, or Run Command with dnf -y update / apt-get -y upgrade.
  4. Reboots.
  5. Waits for a healthy heartbeat.
  6. Returns the host to service.

It moves on to the next batch within a concurrency limit, keeping at least MinVMs ready. State lives in dbo.MaintenanceRuns. The task function advances the runs.

Open questions. Azure Update Manager or Run Command? Update Manager supports RHEL and Ubuntu, but needs extra permissions and is region-dependent in sovereign clouds.

2.10 Broadcast messages

Status: Done · depends on the 2.3 host script

Shipped. POST /api/sessions/broadcast, Message everyone on the Sessions page, and Send message in the host list's bulk bar. Where it differs from the design below:

  • Hosts run session-control.sh message-all in parallel, within a concurrency limit and a deadline as Apply Now does. The result names each host's outcome (delivered, no session, agent too old, failed) and the hosts there was no time to try. Every message is audited.
  • A restart does not broadcast by itself. Warning and then acting is what a maintenance run with a deadline does (2.9).

A portal action sends a notification to every active session, or to a filtered set ("host restarts in 10 minutes"). It reuses the notify-send/xmessage path in release-session.sh (warn_idle_user) through session-control.sh message.


Phase 3: operating system and desktop support

Status: Done, except the 3.5 spike. Items 3.1–3.4, 3.6 and 3.7 shipped together, with host agent 1.2.0. Each has a Shipped note on where it differs from the design below it, and 3.8 lists what the validation left open.

3.0 Support matrix

Target Today Target state
RHEL 7 Offered (7-LVM). Maintenance ended June 30, 2024; Extended Life-cycle Support only. Remove (3.3)
RHEL 8 Works. GNOME on Xorg via xorgxrdp. Keep
RHEL 9 Works, and it is what production uses. Xorg is deprecated but present. Primary target
RHEL 10 Not offered. Red Hat removed the Xorg server (Xwayland only), and GNOME is Wayland-only. Needs a new remoting backend (3.5)
Ubuntu 24.04 Offered and the Bicep default, but it deploys the server image and the desktop install is commented out (Configure-Ubuntu24_desktop-Host.sh, DEPLOYMENT.md). It isn't a usable desktop. Complete it (3.1)
Ubuntu 26.04 Not offered. GNOME is Wayland-only (Ubuntu 25.10 dropped "Ubuntu on Xorg", and GNOME 49 removed X11). Xorg remains for other desktops. XFCE/MATE with xrdp (3.2), or the 3.5 backend
Rocky / Alma 9 Not offered Optional (3.7)

After Phase 3. RHEL 7 is gone (3.3). RHEL 8 and 9, Rocky Linux 9 and AlmaLinux 9 (3.7), and Ubuntu 24.04 (3.1) each run GNOME, Xfce or MATE (3.2), and RHEL 9 is the default. The validation covered Xfce and MATE on RHEL 9 and Ubuntu, and GNOME on every distribution except Rocky. RHEL 10 still needs the 3.5 backend. Ubuntu 26.04 could run Xfce or MATE on Xorg, but isn't offered yet (3.8).

The current design depends on Xorg in three places:

  • xrdp's xorgxrdp backend.
  • Session inspection: xrdp-who-xorg.sh uses ps -C Xorg and the xrdp_display sockets.
  • Idle detection: xprintidle against the X display.

Every distribution that is going Wayland-only needs either a desktop that still runs on Xorg, or a different remoting stack.

3.1 Ubuntu 24.04 as a real desktop target

Status: Done · no dependencies

Shipped. The default linuxHostOsVersion is 9-LVM, Configure-Ubuntu24_desktop-Host.sh installs a desktop, and one release agent serves every distribution. Where it differs from the design below:

  • 24_04-lts keeps its name and still maps to Canonical's server image, and the bootstrap adds ubuntu-desktop-minimal. There is no 24_04-desktop value.
  • A session launcher, linux_host/xrdp-startwm.sh, replaces editing startwm.sh. The bootstrap and the host migration make it xrdp-sesman's DefaultWindowManager on every distribution. It starts the desktop named in /etc/linuxbroker/desktop.conf, which for GNOME on Ubuntu is Ubuntu's session on Xorg, unlocks the login keyring (3.4), and puts /etc/linuxbroker/xdg ahead of /etc/xdg. Without desktop.conf, as on a migrated host, it runs the distribution's own script.
  • The launcher's --install also adds the polkit rule for the color-profile and PackageKit refresh prompts (45-linuxbroker-xrdp.rules), so every distribution gets it.
  • The bootstrap leaves out the first-login wizard and whoopsie, disables apport and hides update notifications from broker users. GNOME 40's welcome tour, which RHEL 9 and AlmaLinux 9 showed at first login, is marked as seen too. Firefox installs on its own, so an unreachable Snap Store can't fail the host, and the snap works with the NFS home (3.4), so Mozilla's APT repository isn't needed.
  • The bootstrap no longer adds Microsoft's package repository or the Azure CLI. That repository has no azure-cli package for 24.04, so the old bootstrap's package install failed, and existing Ubuntu hosts lack nfs-common, jq and dconf-cli. They must be replaced or bootstrapped again.
  • ubuntu-desktop-minimal brings NetworkManager and a netplan file that hands every interface to it. The next restart of systemd-networkd, which needrestart did when the Defender for Endpoint extension installed a package, left the host off the network until it rebooted. The bootstrap now keeps networkd as netplan's renderer. The cost is that GNOME shows no network indicator (3.8).
  • Broker users get /bin/bash instead of Ubuntu's default /bin/sh.
  • Migrate-LinuxHostReleaseAgent.ps1 failed on every Ubuntu host: Run Command starts a script without a #! line with dash, which stopped at set -o pipefail. It now declares bash.

Quick win, do it first: change the Bicep default linuxHostOsVersion from 24_04-lts to 9-LVM until Ubuntu is complete. Today a default azd up with Linux hosts produces hosts with no desktop.

Design.

  • Configure-Ubuntu24_desktop-Host.sh takes LINUXBROKER_DESKTOP (gnome | xfce, 3.2):
    • gnome: ubuntu-desktop-minimal, with the xrdp session started as "Ubuntu on Xorg" (set GNOME_SHELL_SESSION_MODE=ubuntu, XDG_CURRENT_DESKTOP=ubuntu:GNOME, XDG_SESSION_TYPE=x11 in startwm.sh or /etc/xrdp/startubuntu.sh).
    • xfce: xfce4 xfce4-goodies with xfce4-session as the xrdp session.
  • polkit rules so xrdp sessions don't show admin prompts for colord ("create a color managed device") and PackageKit ("refresh system repositories"). These are well-known xrdp-on-Ubuntu papercuts.
  • Disable the GNOME initial-setup wizard and "What's new" tour for broker-created users.
  • Firefox: the Ubuntu archive ships it as a snap. Validate it with the NFS-backed home (3.4), and if that's unreliable switch to Mozilla's APT repository.
  • Agent parity: merge linux_host/session_release_buffer/RHEL/release-session.sh and .../Ubuntu/release-session.sh into one script with distribution detection. The copies differ only in ensure_jq_installed and the RHEL-only orphaned-mount cleanup, which Ubuntu should have too. Update the CSE and Migrate-LinuxHostReleaseAgent.ps1. Delete the unused xrdp-who-xnc.sh.
  • Bicep: map 24_04-lts to the same server image, since the desktop is installed on top. Rename the parameter value or add 24_04-desktop for clarity. Update DEPLOYMENT.md and the README's supported-distributions list.

Done when. A default Ubuntu deployment yields a working GNOME (and XFCE) desktop through the AVD RemoteApp, and passes the 3.4 checklist.

3.2 Desktop environment choice

Status: Done · after 3.1

Shipped. linuxHostDesktop (gnome, xfce or mate) for every bootstrap, MATE and Xfce branches in apply-host-settings.sh, and a note on Host Settings when the fleet runs Xfce or MATE. Where it differs from the design below:

  • MATE is offered on every distribution, as Xfce is. The bootstrap records the desktop in /etc/linuxbroker/desktop.conf, and the session launcher (3.1) starts it.
  • MATE takes the screen lock policy from dconf (org.mate.screensaver, and org.mate.lockdown disable-lock-screen), and Xfce from xfconf system defaults with kiosk locks. Both count the blank and lock delays in whole minutes, up to 8 hours, and Xfce sessions read a change only when they start.
  • Ubuntu MATE's panel uses MATE's own default layout. The Ubuntu MATE layout, which Ubuntu's MATE settings package makes the default, needs three applets the core MATE packages leave out, so every new user was asked to delete three broken applets.
  • With gnome, the extension command is unchanged, so hosts that keep the default see no change.
  • Measured in 3.4, a session used 0.6–0.9 GB of memory with Xfce or MATE, 1.5–2.1 GB with GNOME, and 2.8–3.0 GB with GNOME and Firefox open.

Why. GNOME Shell under xrdp renders in software (llvmpipe) and costs a lot of CPU per session. XFCE and MATE are native X11 desktops: much lighter, and not affected by GNOME's move away from X11. That matters even more with multi-session hosts (4.3).

Design.

  • Bicep parameter linuxHostDesktop (gnome default, xfce, mate) passed to every CSE. On RHEL, XFCE and MATE come from EPEL.
  • Host settings: the screen-lock policy is dconf/GNOME-only (apply-host-settings.sh). Add an XFCE branch (xfconf system defaults plus kiosk locks for xfce4-screensaver / light-locker), selected by detecting the installed desktop. The portal should show a note when a setting doesn't apply to the fleet's desktop.
  • The heartbeat (2.2) reports the desktop, so mixed fleets are visible.

3.3 Retire RHEL 7

Status: Done · no dependencies

Shipped as designed. An azd environment that still stores 7-LVM fails template validation at the next azd provision, even with deployLinuxHosts=false, so the upgrade notes say to change it first. patch-host.sh and the host migration still support existing RHEL 7 hosts.

Remove 7-LVM from deploy/bicep/main.bicep, main.resources.bicep, modules/Linux/main.bicep and the regenerated main.json. Delete custom_script_extensions/Configure-RHEL7-Host.sh and remove RHEL 7 from the README and DEPLOYMENT.md. Existing RHEL 7 hosts keep working, but new deployments can't choose it.

3.4 GNOME validation and the login keyring

Status: Done · after 3.1; the checks that need mstsc are open in 3.8

Shipped. The checklist ran on GNOME, Xfce and MATE on Ubuntu 24.04 and RHEL 9, and on GNOME on RHEL 8 and AlmaLinux 9, with FreeRDP 3.31 as the RDP client. Each item below notes its result. It confirmed that nothing unlocked a login keyring at sign-in, and the keyring now unlocks with a variant of option 1:

  • The account password still changes at every checkout. Instead, the broker keeps a random key for each user, the secret keyring-<uid> in a second Key Vault that holds nothing else, and the API has write access to that vault only. The API creates the key at the user's first checkout and sends it to the host with the password.
  • create-user.sh writes the key to /run/linuxbroker-keyring/<user>, which is in memory and readable only by the user. Releasing the lease removes it.
  • The session launcher (3.1) unlocks the login keyring with the key before the desktop starts, or creates the keyring at first sign-in. It then checks over D-Bus that the keyring is unlocked, because gnome-keyring-daemon --unlock succeeds even with the wrong key.
  • A keyring the key doesn't open, such as one a user created with a password of their own before the upgrade, is moved to ~/.local/share/linuxbroker/keyring-backup/ and replaced.
  • An applied profile reset writes a new version of the key. The older versions stay, so the keyring kept with the old profile can still be opened.
  • The keyring never blocks a sign-in. Without a key, the desktop starts with the keyring locked, as it did before.
  • No PAM file changes. Neither family has pam_gnome_keyring in xrdp-sesman's stack, and chpasswd runs as root without the old password, so the module couldn't re-key a keyring.

The validation also found four agent faults, fixed in the same release:

  • The idle timeout had never disconnected anyone, on any distribution: the agent looked for the xrdp connection by a socket path that ss prints only for the X server's end. It now follows the socket's peer.
  • A resumed session was disconnected again at once, because the X server's idle counter runs on while no one is connected. Idle time now counts from no earlier than the current connection.
  • Tracker crawled the roaming homes. On RHEL 9 it restarted every 13 seconds on an index that Ubuntu's newer Tracker had written, reading about 0.6 MB/s from the share. Hosts now mask the Tracker and LocalSearch user services and hide their autostart entries.
  • When a grace period expired, the agent logged an error because the Xorg it had just killed was still exiting. It now waits up to five seconds.

Why. Every checkout sets a new random password (generate_secure_password() then chpasswd in api/app.py), and the home directory roams on NFS. GNOME Keyring encrypts the login keyring with the password the user had when it was created, so from the second session on, automatic unlock at login is expected to fail. Browsers, VS Code and other libsecret apps would then prompt for a password the user never knew. This needs confirming on a real host.

Test checklist (per distribution and desktop):

  • With Keep sessions alive during the grace period on (Phase 1, off by default): disconnect and reconnect within grace resumes the same desktop, including from a different AVD host. An idle disconnect resumes. At grace expiry the session and Xorg are gone and cleanup completes. Memory held by disconnected sessions stays within the VM size. Result. Passed, including from a second AVD host and with Firefox open. The idle disconnect needed the two idle fixes above. Hosts with disconnected sessions used 1.2 to 3.5 GB of their 7.6 GB.
  • First login; second login on a different host; keyring unlock prompts. Result. Passed with the keyring key on RHEL 8, RHEL 9 and Ubuntu GNOME, with no prompts. Secrets stored on Ubuntu were readable on RHEL 9, and the other way round.
  • Browser: the Firefox snap (Ubuntu) and Flatpak (RHEL 10+) behave with an NFS home. Profile lock after an unclean disconnect. Result. The Firefox snap works with the NFS home. Firefox killed on AlmaLinux reopened on RHEL 9 with its tabs and no "already running" prompt, because NFS 4.1 released the lock. Flatpak waits for RHEL 10 (3.5).
  • Disconnect, then reconnect inside the grace period and resume the same session. Result. Passed: the same X server, windows and unlocked keyring.
  • Reconnect after the grace period expires: a fresh session with the profile intact. Result. Passed. Both test users landed on a different host, with the keyring unlocked and their secrets intact.
  • The idle warning appears, and the idle disconnect preserves the session. Result. The warning appeared on Ubuntu, and after the idle fixes the disconnect kept the session. RHEL, Rocky and AlmaLinux have no xprintidle, so they neither warn nor disconnect (3.8).
  • Clipboard in both directions, audio, resolution change, multi-monitor, full screen. Result. The clipboard works both ways on every desktop. The rest needs mstsc (3.8): resizing the window works on RHEL 9 but drops FreeRDP 3.31 on Ubuntu (xrdp 0.9.24, neutrinolabs/xrdp#3877), RDP audio can work only on Ubuntu GNOME, and the test client can't show several monitors.
  • Screen lock posture matches the Host Settings profile, and lock after reconnect. Result. Passed on every desktop, with the default profile and with a STIG-style one that locks after 60 idle seconds. A resumed session was checked only with the lock off. A session that is already idle needs one input before a new idle delay applies.
  • GNOME Tracker/LocalSearch and other indexers aren't crawling the NFS home. Result. Failed, then fixed (see above). With the fix, no indexer runs, and an idle session moves at most 208 bytes over NFS in a minute.
  • ~/.cache size and I/O on NFS during normal use (feeds 4.6). Result. 1.3 to 19 MB per user. With no indexer, I/O is only what the user's applications do.
  • Log off cleans up: the account is removed, the home is unmounted, and the profile on the share is intact. Result. Passed, from the desktop's own log-off on Xfce and GNOME.

Keyring fix options. The first was chosen, with a key that is separate from the password; see Shipped above.

  1. A stable per-user secret instead of a password rotated at every checkout. Store it in Key Vault keyed by VmUsers.uid, and rotate it only on profile reset. This is the simplest, but it changes the credential model.
  2. Configure pam_gnome_keyring so the login keyring uses an empty password, created at first login. Secrets are then protected only by file permissions on the NFS home.
  3. Disable the gnome-keyring secrets component and use per-application stores. This breaks some applications.

3.5 RHEL 10 and Wayland-only desktops

Status: Planned (spike) · no dependencies

Why. RHEL 10 removed the Xorg server. GNOME on Ubuntu 25.10+ is Wayland-only. The upstream answer for multi-user remote desktops is GNOME Remote Desktop in its headless "remote login" mode (GNOME 46+), which provides RDP sessions through GDM.

Spike questions.

  • Can gnome-remote-desktop serve concurrent headless sessions for broker-created users, with per-user credentials set at checkout?
  • How do we detect session state (connected, disconnected, idle) without Xorg? Candidates: loginctl session properties, GNOME Remote Desktop D-Bus, and Mutter idle monitor over D-Bus.
  • Does a reconnect return to the same session? What is the lock-screen behavior?
  • Performance and codec support (it uses the RDP graphics pipeline) compared with xrdp.

Design direction. Introduce a "remoting backend" abstraction in the host agent: session_list, session_state, idle_seconds, disconnect and terminate, with an xrdp-xorg implementation (today's code) and a gnome-remote-desktop implementation. The broker API doesn't change. Checkout still returns a host and credentials, and the AVD side still launches mstsc.

Done when. There is a written go/no-go with a prototype on RHEL 10, and the remaining work is estimated as a follow-up item.

3.6 xpra application mode

Status: Done (removed)

Shipped. xpra is removed. New hosts don't install it and allow only SSH and RDP, and Migrate-LinuxHostReleaseAgent.ps1 removes xpra's repository, packages and signing key from existing hosts and closes TCP 443. Connect-LinuxBroker.ps1 opens the desktop whatever -Mode it gets and logs a warning for any value other than desktop, so a RemoteApp that passes one still works. Publishing single Linux applications is a follow-up (3.8).

avd_host/broker/Connect-LinuxBroker.ps1 accepts an application name for xpra mode, but the branch is a stub (# Add XPRA command). The host scripts still install xpra from third-party repositories and open TCP 443, and the README advertises "virtualized applications". Either:

  • Implement it: publish individual Linux apps as AVD RemoteApps. Each RemoteApp calls the broker with -Mode <app>, and the script launches the xpra client (bundled on the AVD image) against the checked-out host in seamless mode. Or
  • Remove it: stop installing xpra, close 443, and correct the README.

3.7 Rocky Linux and AlmaLinux 9 (optional)

Status: Done · no dependencies

Shipped. linuxHostOsVersion accepts rocky-9 and alma-9, and both run Configure-RHEL9-Host.sh. Where it differs from the design below:

  • The bootstrap reads the distribution from os-release. On Rocky and AlmaLinux it skips subscription registration, enables CRB, installs EPEL from the distribution's own epel-release package, and installs firewalld, which their Azure images leave out.
  • Both get the 64 GB OS disk RHEL hosts have, because their images are 10 GB and 30 GB.
  • Rocky's image is a free Marketplace offer with a purchase plan. Preprovision accepts its terms, but the subscription must also be allowed to buy Marketplace offers, so DEPLOYMENT.md recommends alma-9 where it isn't.
  • AlmaLinux 9 with GNOME passed the 3.4 checklist. Rocky Linux 9 is not validated on a live host, because the test subscription can't buy Marketplace offers (3.8).

The RHEL 9 script works with little change: skip subscription-manager and use the distribution's CRB repository name. That's useful where RHEL subscriptions are an obstacle. Add rocky-9 and alma-9 image mappings. Migrate-LinuxHostReleaseAgent.ps1 already treats rocky and almalinux as RHEL-like.

3.8 Follow-ups from the Phase 3 validation

Status: Planned · no dependencies

The 3.4 validation left these open. The first three need checking with mstsc, the client the broker starts, which the test client couldn't stand in for. Items marked pre-existing were there before Phase 3.

Item Why Direction
Checks with mstsc The test client couldn't present several monitors or play sound. The launcher now opens the desktop full screen across every monitor (4.8), which nobody has checked through AVD yet, including whether a RemoteApp session gives the inner mstsc more than one monitor Through AVD, on an Ubuntu and a RHEL host: resize and maximize the window, use full screen and two monitors, and play sound on Ubuntu GNOME
Resizing on Ubuntu A live resize dropped FreeRDP 3.31 on xrdp 0.9.24 (neutrinolabs/xrdp#3877), and with Keep sessions alive off the agent then ended the session. RHEL 9's xrdp 0.10.6 resized fine. If mstsc drops too, ship a fixed xrdp, or evaluate turning dynamic resolution off in the user's Default.rdp, which mstsc /v: reads without the warning that a written .rdp file now brings (4.8)
RDP audio RHEL, Rocky and AlmaLinux package no xrdp audio module. On Ubuntu, Xfce runs PulseAudio, which has no xrdp module in the archive, and MATE starts no sound server, so only GNOME, with PipeWire and pipewire-module-xrdp, can play sound. Build or ship pipewire-module-xrdp for the RHEL family, and run PipeWire in Xfce and MATE sessions
Idle timeout on the RHEL family RHEL, Rocky and AlmaLinux don't package xprintidle, even in EPEL, so those hosts neither warn nor disconnect idle sessions Read the X idle time another way, for example with python3 calling XScreenSaverQueryInfo in libXss through ctypes
Host reboot during a lease (pre-existing) The lease file survives the reboot, but the home isn't mounted again and the agent has no record of the user, so the host stays checked out until someone returns it, and a reconnect lands in an empty local home Reconcile leases at boot: mount the home again, or release the lease
Group IDs differ between hosts (pre-existing) Only the uid is pinned. The user's own group, tsusers and appusers get whatever gid is free on each host, so group ownership of roaming files means different groups on different hosts. It does no harm while homes are 700. Create the user's group with gid = uid and give the shared groups fixed gids, with a migration for existing hosts
Ubuntu 26.04 Its GNOME is Wayland-only, but Xfce and MATE still run on Xorg Offer it with Xfce or MATE. GNOME waits for 3.5, as RHEL 10 does.
Publishing single applications With xpra gone (3.6), the broker publishes only full desktops Evaluate xrdp's RemoteApp (RAIL) support, or what the 3.5 backend offers
No network indicator in Ubuntu's GNOME systemd-networkd runs the network (3.1), so GNOME shows no network icon, and applications that ask NetworkManager, such as GNOME Software, may think the host is offline Document it, or let NetworkManager manage the NIC without netplan removing networkd's configuration
No browser in Xfce and MATE on the RHEL family Only the GNOME install brings Firefox Install Firefox with every desktop on the RHEL family
First-login windows on RHEL 8 GNOME A new profile shows Getting Started and a "System Not Registered" notice Hide both, as 3.1 does for GNOME 40's tour
Lock Screen entry in Xfce With the lock off, Xfce's action menu still shows Lock Screen, which does nothing Hide the entry when the Host Settings profile turns the lock off
Rocky Linux 9 on a live host The test subscription can't buy Marketplace offers, so only AlmaLinux 9 was validated Validate rocky-9 in a subscription that can
Two keyring daemons on Ubuntu GNOME GNOME starts its own gnome-keyring-daemon.service next to the launcher's. It owns no bus names and opens no keyring, and uses about 10 MB. Have the launcher start that user unit instead of its own daemon
Xfce sessions stay "closing" on RHEL 9 GeoClue's demo agent outlives the X server, so after a disconnect with Keep sessions alive off the login session stays "closing" until the grace period ends. Nobody sees it, and the agent goes by Xorg. Add its autostart entry to the ones the launcher hides

Phase 4: strategic scale

Status: In progress. The foundations, items 4.1 and 4.5–4.9, shipped together, with host agent 1.3.0, and the home directory share now mounts on /nfs_profiles. Each has a Shipped note on where it differs from the design below it, and a Validated note on what the Phase 4 validation confirmed in a public-cloud test environment with two RHEL 9 hosts and a Windows session host, which had no interactive AVD client. 4.3 and 4.4 come next, together, then 4.2 and 4.10.

4.1 Start a host on demand at checkout

Status: Done · depends on Phase 1 (readiness and scaling fixes)

Shipped. A checkout that finds no ready host starts one and answers 202, the AVD script waits for it, and a rule or window may keep a minimum of 0 hosts. Where it differs from the design below:

  • ReserveVmForStart runs under the scaling application lock, so it never races a scaling run. It starts at most one host per waiting user, and at most MaxPendingStarts at once (2 by default, 1–20), never past the active phase's MaxVMs. A user who arrives while enough hosts are starting waits for one of them. The API commits before it asks Azure, and records the host as off again if Azure refuses.
  • retryAfterSeconds isn't fixed at 60: it's the median start-to-reachable time over the last week, less how long the oldest starting host has taken, kept between 30 and 120 seconds, and the Retry-After header carries it too. While a user waits, each request probes the starting hosts on port 22, so a host is handed out without waiting for the task's probe, which runs every two minutes.
  • Start on demand is on by default. The Start on demand card on the Scaling page turns it off and sets the pending-start limit. A minimum of 0 can be saved only while it's on, and if it's turned off later, scaling reads 0 as 1.
  • The AVD script (2.0.0) waits in a modeless window with Cancel, up to -MaxWaitSeconds (600 by default). It asks again after Retry-After, or 30, 30, then 60 seconds when the broker gives none, gives up after three transient failures in a row, and renews a refused token once. It sends clientVersion with each checkout, and the Scaling page names the AVD hosts whose latest checkout reported none, because their script can't wait.
  • Update-AvdHostBrokerScript.ps1 replaces the script on existing AVD hosts through Run Command, and Migrate-ExistingEnvironment.ps1 runs it after the Linux host migration.
  • Checkout events gain a Starting outcome. Scaling counts waiting users as demand and keeps a host for each of them when scaling down, and the dashboard reports waits, how many were served, and their median and 95th percentile.

Validated with the minimum at 0 and both hosts stopped:

  • The first checkout from the 2.0.0 script got 202 and started one host. The API probed the host on the script's next requests, and the script had it 67 seconds after the first request. The dashboard showed the wait, with a median of 65 seconds, and the audit entry carried the script's version.
  • With MaxPendingStarts at 1, a second waiting user got 202 and no second start; at 2, a second host started. At MaxVMs, a checkout got 409. The Retry-After header matched the body each time.
  • A minimum of 0 was refused while start on demand was off. Once the hosts were returned, scaling stopped both again. The broker listed the two test clients, which sent no version, among the session hosts whose script can't wait.
  • One user on the only running host fills the pool, so the next scaling run started ScaleUpIncrement more hosts, as it does for any full pool. README.md and DEPLOYMENT.md now say so.

Open. From a real AVD session: Cancel in the waiting window, and what a script older than 2.0.0 shows while a host starts for its user.

Why. When the pool is exhausted, the user sees "No Linux host is available right now. Try again in a few minutes." (Connect-LinuxBroker.ps1). The script retries three times immediately, and nothing starts until the next 5-minute scaling run.

Design.

  • API: when CheckoutVm finds nothing, call a new ReserveVmForStart. It locks a powered-off Available host (respecting MaxVMs and a cap on pending starts), marks it On/Unreachable, starts it in Azure, and answers 202 {"status": "Starting", "retryAfterSeconds": 60}.
  • AVD script: on 202, show a non-modal "Your Linux desktop is starting…" window and poll checkout with back-off (for example 30 s, 30 s, 60 s…, up to a configurable limit). Keep the 409 path for "the pool is at maximum".
  • Record the event for the unmet-demand metric (2.6).
  • Once this exists, relax the Phase 1 MinVMs ≥ 1 rule, so a pool can scale to zero off hours and wake on the first checkout.

4.2 Golden image and an elastic pool

Status: Planned · no dependencies (pairs well with 3.1 and 3.2)

Why. Every host builds itself at provisioning time: dnf update plus Server with GUI, repositories, xrdp and agents (custom_script_extensions/*). That's slow and non-deterministic. Hosts drift with the upstream package state, and the pool size is fixed by linuxHostCount. Scaling can only power existing VMs.

Design.

  • An image pipeline (Azure Image Builder or Packer) builds per distribution and desktop, with packages, xrdp config, agents and hardening baked in, and publishes to an Azure Compute Gallery replicated to the deployment regions (Gallery is available in Government).
  • Bicep: linuxHostImageId (gallery image version). When it's set, the CSE only writes configuration (API URL, client ID, settings seed). cloud-init is an alternative.
  • Elastic pool: a pool manager (new task-function timer plus API endpoints) creates hosts from the image when the pool is at MaxProvisioned but needs more, and deletes idle surplus hosts. This needs VM Contributor-level rights and network join on the subnet, so run it under its own identity rather than widening the API's role.
  • Scripts are pinned to the image version, which also fixes supply-chain concerns about hosts downloading main at boot (see hardening).

4.3 Multi-session Linux hosts

Status: Planned · depends on 2.2 (session reporting); benefits from 3.2 (a lighter desktop)

Why. Every Linux VM serves exactly one user (CheckoutVm assigns the whole VM, and VirtualMachines.Username is a single column). This is the biggest cost lever. xrdp supports many concurrent sessions, and the host agent already works per user (per-user lease files, releases and grace timers).

Design.

  • SQL: a new dbo.VmAssignments table (AssignmentId, VMID, Username, LeaseId, Status CheckedOut/Released, AvdHost, CheckedOutDate, ReleasedDate) and VirtualMachines.MaxSessions (default 1, which preserves today's behavior). VmStatus becomes host-level only (Available / Draining / Maintenance). CheckoutVm picks a host by load-balancing mode: breadth-first (fewest sessions) or depth-first (fullest below max, which saves cost).
  • A migration moves existing assignments from VirtualMachines columns into VmAssignments. The legacy columns become a computed or compatibility view during the rollout.
  • API: release, return and sweep work per assignment. delete_remote_user is unchanged, because it's already per user.
  • Scaling: utilization = sessions ÷ (serviceable hosts × MaxSessions).
  • Host: per-user resource limits through systemd user-.slice drop-ins (CPUQuota, MemoryMax), private /tmp per user (pam_namespace), and per-host session caps.
  • Portal: hosts show N/M sessions, and the Sessions page (2.3) becomes the primary view.

Measured in 3.4. A session used 0.6 to 0.9 GB of memory with Xfce or MATE, 1.5 to 2.1 GB with GNOME, and 2.8 to 3.0 GB with GNOME and Firefox open. A preserved session keeps its memory while it's disconnected. On a host with 8 GB, that leaves room for several Xfce or MATE sessions but only two or three GNOME ones.

Open questions. Sizing guidance per desktop. Noisy-neighbor limits. Whether some users or pools should stay single-session (see 4.4).

4.4 Host pools

Status: Planned · depends on 2.5 (policy per pool)

Why. One undifferentiated pool can't serve users who need GPUs, bigger VMs or a different image.

Design.

  • dbo.HostPools (PoolId, Name, Image, VmSize, LoadBalancing, MaxSessions) and VirtualMachines.PoolId. Scaling policy and host settings become per pool (LinuxHostSettings.SettingsScope gains pool scope).
  • Checkout takes a pool. Each pool is a separate AVD RemoteApp whose command line passes -Pool <name> to Connect-LinuxBroker.ps1.
  • Portal: a pool selector across the hosts, scaling and settings pages.

4.5 AVD scaling plan for the pass-through host pool

Status: Done · no dependencies

Shipped. The deployment creates a scaling plan for the AVD host pool, turns on Start VM on Connect, and gives the Azure Virtual Desktop service principal the role both need. Where it differs from the design below:

  • The role is on the subscription, not the host resource group. Autoscale works only with Desktop Virtualization Power On Off Contributor on the whole subscription, so the deployment assigns it there. That needs Owner or User Access Administrator, and lets Azure Virtual Desktop start and stop any session host in the subscription. preprovision finds the service principal by its app ID only, never by its display name, and checks whether it holds the role already, directly, through a group or from a management group, and whether the deploying account can assign it. When the role is there it assigns nothing, and when it can't be assigned the plan is deployed assigned to no host pool and preprovision prints the command for an Owner, instead of the deployment failing. assignAvdAutoscaleRole=false leaves the role to an administrator.
  • Microsoft documents one app ID for Azure Virtual Desktop, 9cdead84-a844-4324-93f2-b2e6bb768d07. avdServicePrincipalAppId still overrides it, and avdServicePrincipalObjectId skips the lookup.
  • Start VM on Connect, so the weekend minimum can be 0. The first user after a quiet spell waits while it starts a session host, and can then wait again for a Linux host: two starts.
  • Weekday and weekend schedules with the same times, 07:00, 09:00, 18:00 and 20:00 in UTC by default. Ramp-up and peak spread new sessions breadth-first, and ramp-down and off-peak pack them depth-first. Nobody is signed out: a session host stops only once it has no sessions, disconnected ones included.
  • Stopped hosts no longer block a deployment. Azure refuses to change a VM extension on a VM that isn't running, and autoscale, like the broker's own scaling and start on demand, leaves hosts deallocated. preprovision lists the Linux hosts and session hosts that aren't running, and the deployment leaves out their extensions. A deployment also replaces a VM's tags, so it writes back the excludeFromScaling tag that keeps autoscale away from a session host.

Validated. azd provision created the plan in UTC, with both schedules and excludeFromScaling as its exclusion tag, assigned it to the host pool and turned on Start VM on Connect. preprovision found that the Azure Virtual Desktop service principal already held the role on the subscription, from an earlier deployment, and assigned nothing. The deployment left out the extensions of the session host that was stopped, and kept the excludeFromScaling tag the validation had given it.

Open. Check that the plan can be assigned right after the role, in a subscription where the service principal doesn't hold it yet, and that Start VM on Connect starts a session host for a real client. Update-AvdHostBrokerScript.ps1 skips session hosts that autoscale has stopped, so updating one means tagging, starting and updating it by hand; the script could start them itself, or session hosts could update the script when they boot.

Design. The Windows AVD hosts only run mstsc, but they're deployed without any autoscale (deploy/bicep/modules/AVD/main.bicep has no scalingPlans resource). Add a Microsoft.DesktopVirtualization/scalingPlans resource for the pooled host pool, with ramp-up, peak, ramp-down and off-peak parameters and a time zone. Assign Desktop Virtualization Power On Off Contributor to the Azure Virtual Desktop service principal on the host resource group; its app ID differs in sovereign clouds, so parameterize it.

4.6 NFS home performance

Status: Done · informed by 3.4

Shipped. A new host script, install-host-config.sh, which the bootstraps and the host migration install and run as root, keeps users' caches off the share, tunes the NFS read-ahead and rotates the broker's logs, and deploy/DEPLOYMENT.md has a sizing guide for the share. Where it differs from the design below:

  • The caches are in /var/cache/linuxbroker/users/<user>, not /var/tmp/xdg-cache/$USER. Only root can create entries in that directory, so no user can create or link another user's cache ahead of them, as they could in world-writable /var/tmp. create-user.sh creates the cache at checkout, owned by the user with mode 700, and replaces anything else it finds there without following links. manage-lease.sh deletes it when the broker returns the host, and systemd-tmpfiles empties the directory at every boot. The session launcher sets XDG_CACHE_HOME only when the directory is the user's own, and /etc/profile.d/linuxbroker-cache.sh does the same in login shells.
  • Browsers aren't configured one by one. Firefox from the distribution's packages and Chromium-based browsers already follow XDG_CACHE_HOME. The Firefox snap on Ubuntu doesn't, because a snap sets its own, so its cache stays on the share.
  • The read-ahead is Microsoft's 15 MiB, from Microsoft's udev rule in /etc/udev/rules.d/99-nfs.rules, and the script applies it at once to NFS mounts that already exist. The rule is Microsoft's but for one character: systemd 255 reports Microsoft's $4 as an invalid substitution each time udev loads its rules, while $$4 passes udevadm verify and still gives awk $4. Like Microsoft's, it applies to every NFS mount on the host.
  • The Bicep default stays at 100 GiB. Its 3,100 baseline and 10,000 burst IOPS carry a small pool, and the guide says how to see throttling and grow the share. The I/O of a sign-in hasn't been measured, so the guide gives no figure per user.
  • Log rotation came with it, though planned for 4.7: /etc/logrotate.d/linuxbroker rotates five broker logs in /var/log weekly, or at 50 MB, and keeps four. linuxbroker-patch.log trims itself.
  • The share mounts on /nfs_profiles, renamed from /awipsprofiles, which the script removes when it is empty and nothing is mounted on it.
  • The alerts on throttling and latency are part of 4.7.

Validated on both hosts after the host migration. The share's read-ahead was 15,360 KiB, /awipsprofiles was gone, and /nfs_profiles was an empty directory with nothing mounted on it between checkouts. A checkout created the user's cache with mode 700 and the user as its owner, a login shell pointed XDG_CACHE_HOME at it, and the return removed it with the account. The share's Transactions metric splits by ResponseType, which the throttling alert filters on, and its end-to-end latency averaged about 3 ms, and 31 ms at most, over the day of the validation.

Open. Measure a sign-in's I/O on the share and add figures per user to the sizing guide. Offer the provisioned v2 model, which Microsoft now recommends for new shares and which provisions IOPS apart from capacity; a v1 storage account can't be converted, so an existing environment would need a new share and a copy of the profiles. SELinux labels the caches var_t, which does no harm while the broker's users are unconfined, as they are by default on RHEL; a host that confines them would need a file context for the directory.

Why. Every user's home, including caches, is on a Premium Azure Files NFS share that defaults to 100 GiB (deploy/bicep/modules/core/nfs-storage.bicep). Premium performance scales with provisioned size: 100 GiB gives roughly 3,100 baseline IOPS. Desktop sessions generate many small I/Os, especially browser and GNOME caches and indexers.

Measured in 3.4. After normal use, ~/.cache held 1.3 to 19 MB per user. With the file indexer off, an idle session moved at most 208 bytes over NFS in a minute. Before that, one Tracker that kept failing on an index written by another distribution's Tracker read about 0.6 MB/s from the share.

Design.

  • A sizing guide by concurrent users, and a Bicep default that reflects it.
  • Keep caches local: /etc/profile.d/linuxbroker-cache.sh sets XDG_CACHE_HOME=/var/tmp/xdg-cache/$USER, with systemd-tmpfiles cleanup. Point browser disk caches at it. Tracker/LocalSearch no longer indexes NFS homes: 3.4 turned it off.
  • Mount tuning per Azure Files NFS guidance (nconnect=4 is already set; consider read_ahead_kb).
  • Alerts on share throttling (Transactions with SuccessWithThrottling) and end-to-end latency, via 4.7.

4.7 Host log shipping and observability

Status: Done · pairs with 2.2

Shipped. A new Bicep module, modules/core/host-monitoring.bicep, adds a data collection rule for the Linux hosts and one for the AVD session hosts, the Linux Broker fleet workbook and the alerts, and deploy/Enable-HostMonitoring.ps1, which postprovision runs, connects the hosts to the rules. deployHostMonitoring leaves all of it out, and an AzureCustom cloud has to opt in. Where it differs from the design below:

  • A script installs the agent, not the deployment. Azure refuses to add an extension to a VM that isn't running, and scaling, start on demand and AVD autoscale all stop hosts, so an agent extension in Bicep would fail azd provision whenever a host is off. The script associates each VM tagged broker-role=linux-host or broker-role=avd-host with its rule, which works on a stopped VM, and installs the Azure Monitor agent, with automatic upgrades, on the running ones. It names each host that isn't running, to be connected with -HostNames once it is started, and postprovision reports its failure as a warning. The agent authenticates with each VM's system-assigned identity and needs no data collection endpoint.
  • More logs. The Linux rule also collects linuxbroker-session-control.log and linuxbroker-patch.log, from 2.3 and 2.9. Each line of the broker's logs starts with a YYYY-MM-DD HH:MM:SS timestamp, which starts a record, so a message of several lines stays one record; createuser.log had no timestamps and now has them. xrdp starts its lines in a format the agent doesn't recognize, so each line of xrdp.log and xrdp-sesman.log is a record of its own. Syslog comes from auth and authpriv at info and up, from kern and user at notice and up, because the kernel reports an NFS server that stops answering at notice, and from every other facility at warning and up. The AVD rule collects the events of Connect-LinuxBroker.ps1 and the Remote Desktop client's critical events, errors and warnings.
  • The syslog group can read the release agent's logs. They name the users signed in to the host, so only root could read them. At each run, the release agent and its watcher now give them mode 640 and the syslog group where the host has one, and keep them at 600 where it doesn't.
  • A fleet snapshot from the database. The heartbeats from 2.2 go to the broker's database, not to Log Analytics, so SQL script 157 adds GetFleetSnapshot, and at the end of each scaling run, every five minutes, the API logs its figures as a fleet snapshot trace: ready, powered-on, in-use and booting hosts, waiting users, stale heartbeats, unreachable shares, missing xrdp, and the scaling minimum and maximum in effect, among others. The workbook's fleet charts and three of the alerts read it. An API ahead of the database logs once per process that the procedure is missing.
  • The alerts. "No ready hosts" fires only while the scaling minimum is above 0 or users are waiting, so a pool that 4.1 scaled to zero raises nothing. "A host with no heartbeat" became "Unhealthy hosts", which also covers a host that reports the share unreachable or no xrdp. Both need every snapshot in the 15-minute window to show the problem, so a host that is briefly busy or starting raises nothing. "No fleet snapshot" is new, and fires when the scaling runs stop or the API can't read the snapshot. Refused checkouts and API errors count 409 and 5xx responses against thresholds that are parameters. The throttling and latency alerts watch only a share the deployment creates.
  • Email only. One action group notifies the addresses in alertEmailAddresses, and a Teams channel through its email address. Without addresses, the alerts still appear in Azure Monitor.
  • Log rotation shipped with 4.6.

Validated on the two RHEL 9 hosts and the Windows session host:

  • Enable-HostMonitoring.ps1 installed agent 1.45 on the Linux hosts, with automatic upgrades, and associated all three VMs with their rules, the stopped session host included. Once that host was started, -HostNames installed the Windows agent on it in under a minute.
  • The agent reads the text logs as root, so their modes don't matter. Installing it created the syslog user and group on RHEL 9, which the hosts didn't have before.
  • Every broker log that had new lines arrived in LinuxBrokerHost_CL, createuser.log with its new timestamps, and so did xrdp.log. The agent sent only the lines written after it started, not the files' history. xrdp 0.10 starts its lines with [2026-09-27T06:17:15.790+0000] rather than 0.9's format, and each line arrived as a record of its own. authpriv messages arrived in Syslog, and test events under the script's LinuxBrokerScript source, an information event and a warning, in Event.
  • Every workbook query ran without error over 24 hours.
  • "Checkouts refused" fired four and a half minutes after a refused checkout. With both hosts checked out and a minimum of 2, "no ready hosts" fired 19 minutes later, once its window held only snapshots with no ready host. With xrdp stopped on one host, "unhealthy hosts" fired 14 minutes later. The share's Transactions metric has the ResponseType dimension that the throttling alert filters on.

Open. linuxbroker-patch.log and xrdp-sesman.log got no lines during the validation, so check that the agent picks up the patch log after it trims itself. "No fleet snapshot" and "API errors" weren't fired.

Design.

  • Deploy the Azure Monitor Agent to Linux hosts, plus a Data Collection Rule for /var/log/release-session.log, /var/log/release-session-watcher.log, /var/log/linuxbroker-host-settings.log, /var/log/createuser.log, /var/log/xrdp*.log and syslog. The logs go to the existing Log Analytics workspace.
  • A workbook covering release and return rates, checkout latency (from API traces), settings-apply failures, per-host error spikes and NFS mount failures.
  • Alerts: no ready hosts, denied checkouts, a host with no heartbeat, API 5xx rate, and share throttling. Action groups can notify email or Teams.

4.8 Tuning the double RDP hop

Status: Done, except the checks through AVD and the CPU measurements · both need an interactive AVD client, which the Phase 4 validation didn't have

Shipped. Connect-LinuxBroker.ps1 opens the Linux desktop full screen across every monitor of the user's AVD session, with mstsc /v:<address> /f /multimon. Where it differs from the design below:

  • Switches, not an .rdp file. Since the April 2026 update (CVE-2026-26151), Remote Desktop Connection warns about every .rdp file that no trusted publisher signed, and turns off every redirection the file asks for, the clipboard included, until the user turns each one back on. Connections that don't start from a file are unaffected, so the launcher keeps mstsc /v:. The properties that have no mstsc switch (session bpp, networkautodetect, bandwidthautodetect, connection type, wallpaper and font smoothing) stay as the user's own Remote Desktop Connection settings have them. Signed connection files are in the hardening backlog. Until they exist, the session hosts must stay out of Microsoft's high-security RDP file configuration, which blocks mstsc /v: too, and DEPLOYMENT.md says so.

  • Both on by default, and each can be turned off. -FullScreen Off opens the desktop in a window on one monitor, and -MultiMonitor Off keeps it full screen on one. The deployment sets them from avdLinuxDesktopFullScreen and avdLinuxDesktopMultiMonitor and passes only Off, so the default RemoteApp command line is unchanged, and scripts older than 2.0.0, which refuse the new parameters, keep working with it.

  • The script refuses an address from the broker that isn't a host name or an IP address, before it changes anything, because mstsc reads anything else on its command line as another switch or a connection file.

  • No H.264 on the Linux hosts. What each distribution's xrdp offers:

    Distribution xrdp Graphics pipeline
    Ubuntu 24.04 0.9.24 None: it arrived in 0.10
    RHEL 9, Rocky Linux 9, AlmaLinux 9 0.10.6.1 from EPEL RFX. The package brings the noopenh264 stub, which xrdp detects and doesn't use
    RHEL 8 0.10.6.1 from EPEL RFX. The package is built without openh264

    Without a GPU, H.264 in xrdp was more sluggish and blurrier than RFX (neutrinolabs/xrdp#3489), so the hosts keep RFX. xrdp's default gfx.toml lists H.264 first, so a host where Cisco's openh264 replaced the stub would switch to H.264. It belongs with GPU encoding on GPU hosts.

Open. Through AVD, check full screen and two monitors, including whether a RemoteApp session gives the inner mstsc more than one monitor, and measure CPU on both hops with GNOME and with Xfce, which feeds 3.2 and 4.3. Both belong with the 3.8 mstsc checks.

Design. The user's session is RDP inside RDP: AVD outer, mstsc to xrdp inner.

  • xrdp ≥ 0.10.2 supports H.264 in the graphics pipeline. Check the version on each distribution (xrdp --version) and enable GFX/H.264 in xrdp.ini where available.
  • Have Connect-LinuxBroker.ps1 write an .rdp file instead of mstsc /v:, to set session bpp, networkautodetect, bandwidthautodetect, connection type, wallpaper and font smoothing, full screen and multi-monitor.
  • Measure CPU on both hops with GNOME versus XFCE, which feeds 3.2 and 4.3.

4.9 Scaling out the portal and API

Status: Done, except the checks in Azure Government · they need a Government environment

Shipped. The portal keeps its sessions in a Redis cache that every instance shares, the API reuses its database connections, and appServicePlanCapacity sets how many instances the App Service plan runs, 1 by default. Where it differs from the design below:

  • A shared session store, with affinity only as the fallback. portalSessionStore defaults to redis. The deployment creates a cache with access keys off, reached only through a private endpoint, gives the portal's managed identity access to it, integrates the portal with the app subnet, and turns ARR affinity off for the portal. It turns affinity off for the API too. With filesystem, and on an AzureCustom cloud, the portal keeps sessions on disk with affinity on.
  • Redis differs by cloud. The public cloud gets Azure Managed Redis Balanced_B0, with its high availability on, because new customers can't create Azure Cache for Redis there since 1 April 2026. Azure Government gets Azure Cache for Redis, because Azure Managed Redis isn't offered there; move it when it is, and before Azure Cache for Redis retires on 30 September 2028. The Government default is Standard_C1, not Standard_C0, which shares a CPU core and which Microsoft recommends only for dev/test. portalRedisSku picks another size, and portalRedisLocation another region, for where the deployment's region doesn't offer the cache or has no room for it. The private endpoint stays in the virtual network, so the portal still reaches a cache in another region privately.
  • Token resource in Azure Government. The portal asks for tokens for https://redis.azure.com by default. In Azure Government the deployment asks for Azure Cache for Redis's application ID, acca5fbb-b7e4-4009-81f1-37e38fd66d78, instead, since Microsoft's documentation accepts both in the public cloud and names no Government URI.
  • The cookie and the lifetime. The session cookie is now Secure and SameSite=Lax as well as HttpOnly. A session ends 12 hours after the operator's last request, when the cache deletes it. SESSION_LIFETIME_HOURS changes that, but azd provision replaces the portal's app settings, so it has to be set again after each provision. Only the sign-in routes and /api/ui load the session, so the page shell and /health keep working while the cache is down, and the portal answers 503 with Retry-After instead of failing to load.
  • A pool without Entra SQL authentication. Each API worker process keeps the connections it has finished with and reuses the newest first. It closes a connection idle for 120 seconds, rather than 300, because App Service forgets an outbound connection after four minutes without traffic, or open for 30 minutes. A connection is rolled back when it returns and closed if that fails. Its next transaction begins when it is handed out again, not when it returned: the SQL integration tests showed that SQL Server stamps a change to a system-versioned table with its transaction's start time and refuses one older than the row's current version (error 13535), which a transaction left open in the pool would be. DB_POOL_ENABLED turns it off. Entra authentication and the mssql-python driver stay in the hardening backlog.
  • Capacity warnings. Each instance's API can run 12 database requests at once, so preprovision warns when the Basic database tier, at most 30, is too small for the capacity, and when sign-ins on several instances would rely on affinity.
  • The task function stays on the plan. Its timers already run on one instance at a time, through a lease in its storage account, and each run is a few calls to the API. A plan of its own, or Flex Consumption, would add cost and a second virtual network integration for no gain.
  • The two stray flask_session/ files are no longer tracked.

Validated in the public cloud:

  • No room in eastus2. Azure refused every size of Azure Managed Redis there with InsufficientCapacity, and left a failed cache that failed the deployment and can't be resized. Nearby regions accepted Balanced_B0, so portalRedisLocation was added, and the validation's cache is in eastus, behind a private endpoint in eastus2.
  • The cache came up with high availability, TLS 1.2, public access off and access keys off. The portal's first request, about five minutes after the deployment gave its identity access, signed in to it as the managed identity.
  • With the plan at two instances, 40 requests that carried one session cookie were answered by both instances, and every one saw the same session. The cookie is Secure, HttpOnly and SameSite=Lax, and lasts 12 hours.
  • With the portal pointed at a port the cache doesn't serve, /api/ui answered 503 with Retry-After: 30 in about six seconds, while the page shell and /health kept answering, and it answered normally within 36 seconds of the port being put back.

Open. In Azure Government, check the token resource and that the Azure Cache for Redis API versions are available. Sign in with a browser on one instance and carry on on another, with the capacity at 2; the validation shared one session between the instances through the portal's API, without a browser sign-in.

Design.

  • The BFF uses filesystem sessions (front_end/app.py), which rely on ARR affinity when scaled out. Move to a shared session store, or keep affinity and document it.
  • The API opens a new pymssql connection per request. Phase 1 caps the concurrency per process. Add real pooling, ideally together with the move to Entra (passwordless) SQL authentication (hardening).
  • Split the task function onto its own plan, or use a Flex Consumption plan, if its timers compete with the API.

4.10 GPU-accelerated OpenGL

Status: Planned · depends on 4.4 (host pools); benefits from 4.2 (golden image) and 4.3

Why. The hosts have no GPU, so OpenGL in an xrdp session renders in software, with Mesa's llvmpipe, on the same CPU as everything else on the host. That serves office work and browsers, but 3D visualization, CAD and other OpenGL applications draw slowly, and on a multi-session host (4.3) one of them slows every session.

Design.

  • A pool of GPU hosts. Host pools (4.4) give GPU VMs their own pool, image and RemoteApp, so only the users who need a GPU get one. The candidates are the sizes Microsoft supports with NVIDIA's GRID drivers for virtual workstations: NVadsA10 v5, which offers from a sixth of an NVIDIA A10 up to whole GPUs, and NCasT4_v3, with NVIDIA T4s. NVv3 retires on 30 September 2026. Check which of them each target region offers, Azure Government's included, and the subscription's GPU quota, before choosing.
  • Drivers. Microsoft redistributes the GRID drivers for these sizes with the vGPU license included, so no NVIDIA license server is needed. They support Ubuntu 20.04 to 24.04, RHEL 8.10 and RHEL 9.4, 9.6 and 9.7, but not Rocky Linux or AlmaLinux. Microsoft's installation steps need Secure Boot and vTPM off, while the deployment gives Linux hosts Trusted Launch with both on, so a GPU pool needs its own security profile. The driver belongs in the pool's image (4.2). It's built for the running kernel, so rolling maintenance (2.9) must check nvidia-smi after a kernel update.
  • VirtualGL in the session. xrdp's X server has no GPU, so OpenGL applications run under VirtualGL's vglrun, which renders them on the GPU and copies each finished frame into the session. Its EGL back end reaches the GPU without a second X server, but it emulates only part of GLX; an application that needs the rest needs the GLX back end and an X server on the GPU. The session launcher can set VirtualGL up, and a pool setting can name the applications to wrap, so users start them from the menu as usual.
  • Encoding stays on the CPU at first. The frames still reach the user as RFX, encoded on the host's CPU (4.8). H.264 encoded on the GPU, through xrdp's graphics pipeline, is later work for once the pool exists.
  • Measure frame rate, GPU and CPU use for the applications the pool is for, with and without vglrun, on each candidate size, and how many sessions one GPU serves.

Open questions. Which sizes to offer, and in which regions. Whether Secure Boot can stay on. How many sessions share one GPU partition. How Wayland-only distributions (3.5) change the approach.


Security hardening backlog

A separate track, prioritized independently of the phases.

Item Why Direction
API connects to SQL as the server admin DB_USERNAME is the SQL admin login (deploy/bicep/main.resources.bicep) A contained database user with EXECUTE on the broker procedures only, or Entra managed-identity authentication, with the mssql-python driver or pyodbc and an access token
avdadmin sudo allowlist is root-equivalent usermod, userdel, groupadd and chpasswd with arbitrary arguments (Configure-*-Host.sh) Once every host runs create-user.sh --password-stdin (Phase 1), drop chpasswd, groupadd and usermod. Move userdel into manage-lease.sh. The allowlist then holds only validated scripts.
SSH host keys not verified StrictHostKeyChecking=no in run_remote_command Record host keys at provisioning (Key Vault or SQL) and pin them, or use an SSH CA
RDP server identity not verified AuthenticationLevelOverride=0 in Connect-LinuxBroker.ps1; xrdp self-signed certificates Issue xrdp certificates from Key Vault or enterprise PKI, and restore server authentication
Launch without a signed connection file Connect-LinuxBroker.ps1 starts mstsc /v: (4.8), so the AVD session hosts can't take Microsoft's high-security RDP file configuration, which allows only files signed by a trusted publisher, and the connection properties that have no mstsc switch stay at their defaults Have the API sign each checkout's .rdp file with a Key Vault certificate that the session hosts trust through the trusted-publisher thumbprint policy. Signing on the session host would expose the key to its users. Pair it with the xrdp certificates above.
Every user of a session host can change the launch script Configure-AVD-Host.ps1 creates C:\Temp with the permissions it inherits from C:\, which give Authenticated Users Modify, as the Phase 4 validation found, and Update-AvdHostBrokerScript.ps1 writes Connect-LinuxBroker.ps1 there too, so one user of a pooled session host can change the script that the others' Linux Desktop runs Install the script in a folder that only administrators can write, such as C:\Program Files\LinuxBroker, from both scripts, and move the RemoteApp's command line there once every session host has it
Username collisions re.sub(r'[^a-zA-Z0-9_]', '', username) maps john.smith and johnsmith to the same Linux account and NFS home Derive usernames from a stable identifier (UPN plus collision check, or object ID) and keep the mapping in VmUsers
Shared SSH private key for the whole fleet One Key Vault secret (KEY_NAME) Per-host keys or short-lived SSH certificates
NFS AUTH_SYS trust sec=sys, NoRootSquash (nfs-storage.bicep, create-user.sh); root on any host in the subnet can read every home Restrict private endpoint access to the Linux host subnet with an NSG. Consider Azure NetApp Files with Kerberos (krb5p) for strong isolation.
Hosts download scripts from main at provisioning scriptSourceRoot defaults to the main branch Pin to a release tag or commit and verify checksums, or bake scripts into the image (4.2)
Checkout abuse The AvdHost role can check out any username Rate-limit per AVD host. Optionally verify that the username belongs to the user signed in to that AVD session.
Portal sign-in has no state, nonce or PKCE /login builds the sign-in URL with get_authorization_request_url alone, and /getAToken redeems any code it receives (front_end/route_authentication.py), so another site can finish a sign-in in an operator's browser with an authorization code of its own (login CSRF) Start the sign-in with MSAL's initiate_auth_code_flow and keep the flow in the session, which every instance now shares (4.9), then redeem it with acquire_token_by_auth_code_flow, which checks state and the nonce and sends the PKCE verifier

Decisions log

Date Decision
2026-09 Roles: Reader (view), Operator (release/return, maintenance, apply settings), and Admin (FullAccess, everything). They are enforced in the API. The bare access_as_user scope no longer grants access. There is a temporary ALLOW_LEGACY_SCOPE_ACCESS toggle for upgrades, off by default.
2026-09 Scale-down powers off by default. Admins can switch a scaling rule to Deallocate in the portal, after being shown the cost, start-latency and capacity-risk trade-offs.
2026-09 Only one scaling rule is active (the lowest RuleID) until schedules (2.5) land. Creating a second rule is rejected.
2026-09 The fix that makes scaling really start and stop VMs goes active immediately on upgrade, with no observe-only mode. This is called out in the upgrade notes.
2026-09 MinVMs ≥ 1 until start-on-demand (4.1) exists, because a pool at zero can't recover without it.
2026-09 If the Azure power-state sync fails, scaling proceeds with a logged warning. Azure power operations are idempotent, and this is no worse than before the sync existed.
2026-09 Session preservation during the grace period is an opt-in Host Setting, off by default. It can't be combined with the screen lock, because a resumed session behind a lock screen can't be unlocked with a rotating password.
2026-09 A returned host isn't offered for checkout until the previous user's cleanup succeeds (CleanupPending).
2026-09 This roadmap lives in docs/ROADMAP.md and is updated as items land.
2026-09 Phase 2 ships in stages. The first PR covers the foundations: 2.4 audit log, 2.1 host actions and drain, and 2.2 heartbeat and fleet health. The rest follows in later PRs.
2026-09 The host heartbeat reports only. Readiness stays on the TCP probe, so a broken heartbeat path cannot take hosts out of rotation.
2026-09 Audit entries stay in SQL for AUDIT_RETENTION_DAYS (default 365) and are also sent to Application Insights. Routine agent traffic is not audited; denials are, up to 30 a minute per caller in each worker process.
2026-09 Stopping a host a user is signed in to needs Admin and the typed hostname, and ends the assignment so the user gets a running host next time. Restart needs the same and keeps the assignment.
2026-09 Drain has no deadline until forced sign-out exists (2.3). Draining hosts are left out of scaling capacity.
2026-09 The rest of Phase 2 (2.3 and 2.5–2.10) ships in one PR, one commit per item, with one host agent rollout (1.1.0, adding session-control.sh and patch-host.sh).
2026-09 Patching runs over SSH through the allowlisted patch-host.sh, not Azure Update Manager or Run Command: no new permissions, and it works in sovereign and air-gapped clouds. The reboot is the Azure restart the API already has.
2026-09 Scaling schedules are time windows that override the single default rule, in one policy time zone, keeping the up/down ratios. Enabled windows may not overlap.
2026-09 Forced sign-out happens only inside a maintenance run whose admin set a deadline, after a warning. The default is to wait, and manual Drain keeps no deadline. Off-peak forced sign-out per phase is deferred.
2026-09 Sign-out releases the host through the broker, not the host agent. A profile reset is applied at the user's next new assignment and keeps the old profile, renamed; removing old profiles is manual. No "reconnect to a specific host" override yet.
2026-09 Scale-down honors MinVMs over MaxVMs, and maintenance admission shares the scaling lock, so neither can take ready capacity below the minimum.
2026-09 Import from Azure requires DNS (<hostname>.<DOMAIN_NAME>); there are no typed-in IPs, and imported hosts start unreachable until the probe reaches them.
2026-09 Checkout and host-start events are kept for CHECKOUT_EVENT_RETENTION_DAYS (default 90) and purged with the audit log.
2026-09 Broker timestamps are UTC; the portal shows relative times with the absolute UTC time as a tooltip. Keyboard shortcuts can be turned off.
2026-09 Phase 3 ships in one PR, one commit per item, with one host agent rollout (1.2.0: the merged release agent, the xrdp session launcher, the keyring key and the xpra cleanup). The 3.5 spike stays separate.
2026-09 New deployments default to RHEL 9 (9-LVM). RHEL 7 is no longer offered, but existing RHEL 7 hosts keep working.
2026-09 xpra is removed rather than implemented. Any -Mode opens the desktop, so existing RemoteApps keep working.
2026-09 The login keyring unlocks with a random key per user, kept in its own Key Vault, instead of making the account password stable. The password still changes at every checkout. A keyring the key can't open is moved aside once and replaced, and a profile reset writes a new key version. The keyring never blocks a sign-in, and no PAM file changes.
2026-09 Every distribution starts sessions through the broker's xrdp session launcher, which falls back to the distribution's own script on hosts with no /etc/linuxbroker/desktop.conf.
2026-09 The Tracker and LocalSearch file indexers are off in broker sessions, because their databases live in the roaming home and don't open across distributions.
2026-09 Ubuntu desktop hosts keep systemd-networkd as the network renderer, at the cost of GNOME's network indicator, so a package install can't take a host off the network.
2026-09 Idle time never counts from before the user's current connection, so a resumed session isn't disconnected for the time it spent disconnected.
2026-09 Ubuntu 26.04 and RHEL 10 wait for 3.5 or 3.8. Rocky Linux 9 is offered through its Marketplace image, and alma-9 is recommended where Marketplace purchases are blocked.
2026-09 Phase 4 ships in stages. The first PR covers the foundations: 4.1 start on demand, 4.5 the AVD scaling plan, 4.6 NFS home performance, 4.7 host log shipping, 4.8 the double RDP hop and 4.9 portal and API scale-out, with one host agent rollout (1.3.0). 4.3 and 4.4 follow in one PR, then 4.2.
2026-09 Start on demand is on by default. It starts at most one host for each waiting user, and at most MaxPendingStarts (2 by default) at once, never past MaxVMs. MinVMs may be 0 only while it is on, and if it is turned off later, scaling reads 0 as 1. This replaces the MinVMs ≥ 1 rule.
2026-09 While a user waits, each checkout request probes the starting hosts on port 22 and records those that answer as reachable, rather than waiting for the task's probe. Readiness still comes from a TCP probe, never from the heartbeat.
2026-09 The AVD script reports its version with each checkout, kept with the checkout event, and the Start on demand card names the session hosts whose latest checkout reported none, because their script can't wait. That's the check before setting a minimum of 0.
2026-09 The AVD autoscale role is assigned on the subscription, because autoscale needs it there, not on the host resource group. preprovision finds the Azure Virtual Desktop service principal by app ID only, assigns nothing when the role is already held, and prints the command for an Owner instead of failing when it can't assign it.
2026-09 A script installs the Azure Monitor agent, not the deployment, because Azure refuses extension changes on a stopped VM and scaling, start on demand and autoscale all stop VMs. For the same reason, a deployment leaves out the extensions of the hosts that aren't running.
2026-09 The home directory share mounts on /nfs_profiles while create-user.sh creates a home, and users' caches stay on the host's disk in /var/cache/linuxbroker/users/<user>, whose parent only root can write, rather than in world-writable /var/tmp.
2026-09 The launcher keeps mstsc /v: and adds /f and /multimon, both on by default, rather than writing an .rdp file, because since the April 2026 update every unsigned .rdp file opens with its redirections off. Signed connection files are in the hardening backlog. The Linux hosts keep RFX, and H.264 waits for GPU hosts (4.10).
2026-09 The portal's sessions move to Redis, with access keys off and the portal's managed identity: Azure Managed Redis in the public cloud, where new customers can't create Azure Cache for Redis since April 2026, and Azure Cache for Redis Standard_C1 in Azure Government, which doesn't offer Azure Managed Redis. portalSessionStore=filesystem keeps sessions on disk, with ARR affinity.
2026-09 The API pools its pymssql connections in each worker process, and the task function stays on the shared App Service plan. Entra SQL authentication and the mssql-python driver stay in the hardening backlog.
2026-09 GPU-accelerated OpenGL (4.10) goes to a pool of GPU hosts once host pools (4.4) exist, rather than to every host.
2026-09 The portal's session cache may be in another region than the rest of the deployment (portalRedisLocation), behind a private endpoint in the deployment's virtual network, because Azure had no room for Azure Managed Redis in eastus2 during the Phase 4 validation. The default stays the deployment's region.
2026-09 A pool that start on demand wakes from zero scales up like any full pool: its first user fills it, so the next scaling run starts ScaleUpIncrement more hosts, ready for the users after them. This is documented rather than special-cased.

Glossary

  • Checkout. The AVD host asks the broker for a Linux host for a user. The broker assigns a host (or reuses the user's existing assignment), creates the Linux account, mounts the NFS home, sets a one-time password, and returns the host and credentials.
  • Lease. A GUID that identifies one assignment (VirtualMachines.LeaseId, and on the host /var/lib/linuxbroker-release-session/leases/<user>.lease). Clean-up only acts when the lease matches, so a stale clean-up can't remove a newer user.
  • Release. The host agent reports that the user disconnected. The host is Released, and the user can reconnect within the grace period.
  • Grace period. GracePeriodSeconds in Host Settings. The host signs a disconnected user off when it expires. With Keep sessions alive on, the desktop survives until then; otherwise it is closed at disconnect and only the assignment is held. The server's sweep returns the host after grace, plus one reconcile interval, plus 60 seconds.
  • Return. Ends the assignment. The host is marked CleanupPending until the Linux account is removed and the home unmounted (the profile on the share is kept), and only then does it become available for checkout.
  • Reconcile run. One execution of release-session.sh, from the systemd timer or the logind watcher.