Configure Azure Virtual Desktop scheduled agent updates with Terraform

In the past you couldn’t control the update pattern of the AVD agent and Geneva monitoring agent installed on your session hosts. These updates were completely controlled by Microsoft in the past and you couldn’t modify this.

With the new scheduled updates you have more control over the update schedule, so it doesn’t impact the users. If you want to learn more about this feature check out this doc’s page.

Since a couple of days the possibility is there to configure this feature with Terraform. In this blogpost I’ll show you how to add the code to your host pool deployment.

The code for the host pool deployment can also be found on my Github.

To enable the scheduled agent updates we need to add a block to the host pool resource. In this example I add 2 maintenance windows on Wednesday and Friday.

Important to know that if the update doesn’t work after 4 times during the update window, the broker will install the update by force.

If you don’t specify the “use_session_host_timezone“, it will use the UTC timezone.

scheduled_agent_updates {
    enabled = true
    schedule {
      day_of_week = "Wednesday"
      hour_of_day = 10
  use_session_host_timezone = true
     schedule {
      day_of_week = "Friday"
      hour_of_day = 10

If we take a look at the entire host pool resource block:

Important to know is that you need to use the latest Terraform provider:

terraform {
  required_providers {
    azurerm = {
      source  = "hashicorp/azurerm"
      version = "=3.22.0"

If you look in the Azure portal you can see the schedule after the Terraform apply.

This concludes this blogpost about deploying Scheduled Agent Updates for AVD host pools with Terraform. If you have further questions about this, feel free to contact me on my socials (@j_vanneuville)

Leave a Reply

Your email address will not be published. Required fields are marked *