MBMihir Bhavsar
All work

Automating Azure Virtual Desktop for five enterprise clients

Provisioning, imaging and scaling Azure Virtual Desktop for five enterprise clients, automated with Terraform, PowerShell, Image Builder and Azure DevOps pipelines.

Measured outcomes

  • 70%+

    less manual effort across 5 clients, with configuration errors near zero

    Azure DevOps pipelines run Terraform and PowerShell, with domain join and Key Vault secrets automated. Timed the task before and after automation.

  • 40%

    faster AVD deployments across clients, ~8 h → ~5 h

    Terraform builds a new client's host pools, session hosts and networking from Image Builder golden images, with FSLogix profiles and autoscaling. Timed the deployment task before and after automation.

  • 450+

    concurrent VDI users supported

    FSLogix user profiles and AVD autoscaling on the clients' host pools.

Context

Five enterprise clients run their virtual desktops on Azure Virtual Desktop, and our team at Parkar Global Technologies runs those estates for them. Bringing up a client's desktops meant a long run of manual steps: build the virtual machines, join them to the domain, give them their secrets, and register them with a host pool.

The work went in phases. First we learned how each client's environment was set up. Then I built the automation that provisions the virtual machines. After that, the team moved on to cost.

Constraints

Requirements and sizing were set per client, and the key decisions were the clients' to make, not mine.

Architecture

One client's estate, built and watched by the automation

Pick one to light up the parts behind it.

  • Azure DevOps pipeline

    • Terraform
    • PowerShell
  • VM Image Builder
  • Key Vault
  • VM provisioning · PowerShell script
  • Client environment · One of five clients

    • Host pool · Autoscaling

      • Session hosts · FSLogix profiles
    • Active Directory · domain join
  • Users · VDI sessions
  • Azure Monitor · Log Analytics · KQL

Connections

  • Key Vault to Azure DevOps pipeline · secrets
  • Azure DevOps pipeline to Client environment
  • VM provisioning to Session hosts · creates VMs
  • VM Image Builder to Session hosts · golden image
  • Session hosts to Active Directory
  • Users to Host pool
  • Azure Monitor to Client environment

An Azure DevOps pipeline runs Terraform and PowerShell, with its secrets kept in Azure Key Vault and the Active Directory domain join automated. For a new client, Terraform builds the host pools, session hosts and networking. My PowerShell provisioning script creates virtual machines inside the client's host pool, end to end. Session hosts are built from golden images that Azure VM Image Builder produces and keep user profiles in FSLogix, and the host pool scales automatically. Azure Monitor and Log Analytics watch the estate, queried with KQL.

What I built and what the team did

My part

  • The Terraform that onboards a new client: its host pools, session hosts and networking.
  • The end-to-end VM provisioning script in PowerShell. It creates a virtual machine inside a host pool, together with the services the machine needs, and finishes by registering it with the pool.

The team of four

  • We operate and support the whole VDI estate, resolving day-to-day VM issues to improve efficiency and the experience for users.
  • The cost-cutting phase that followed was a team effort, built on right-sizing and auto-scaling.

What broke

The provisioning script's last step installs the RDAgent and the Boot Loader on the new machine, which is what lets the machine be assigned to a host pool. That step kept failing. I dug into it, found the steps that were missing, added them, and after that the script worked.

Results

Provisioning a client's session hosts now runs through a pipeline, and with the domain join and secrets automated, configuration errors are close to zero. The measured figures are at the top of this page. Monitoring with Azure Monitor and Log Analytics also shortened the time it takes to resolve support incidents. I don't have a number for that, so I don't give one.