Skip to content

azurermVirtualDesktopHostPool

Manages a Virtual Desktop Host Pool.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as azurerm from "./.gen/providers/azurerm";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm.
For a more precise conversion please use the --provider flag in convert.*/
const azurermResourceGroupExample = new azurerm.resourceGroup.ResourceGroup(
  this,
  "example",
  {
    location: "West Europe",
    name: "example-resources",
  }
);
const azurermVirtualDesktopHostPoolExample =
  new azurerm.virtualDesktopHostPool.VirtualDesktopHostPool(this, "example_1", {
    custom_rdp_properties: "audiocapturemode:i:1;audiomode:i:0;",
    description: "Acceptance Test: A pooled host pool - pooleddepthfirst",
    friendly_name: "pooleddepthfirst",
    load_balancer_type: "DepthFirst",
    location: azurermResourceGroupExample.location,
    maximum_sessions_allowed: 50,
    name: "pooleddepthfirst",
    resource_group_name: azurermResourceGroupExample.name,
    scheduled_agent_updates: [
      {
        enabled: true,
        schedule: [
          {
            day_of_week: "Saturday",
            hour_of_day: 2,
          },
        ],
      },
    ],
    start_vm_on_connect: true,
    type: "Pooled",
    validate_environment: true,
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermVirtualDesktopHostPoolExample.overrideLogicalId("example");

Argument Reference

The following arguments are supported:

  • name - (Required) The name of the Virtual Desktop Host Pool. Changing this forces a new resource to be created.

  • resourceGroupName - (Required) The name of the resource group in which to create the Virtual Desktop Host Pool. Changing this forces a new resource to be created.

  • location - (Required) The location/region where the Virtual Desktop Host Pool is located. Changing this forces a new resource to be created.

  • type - (Required) The type of the Virtual Desktop Host Pool. Valid options are personal or pooled. Changing the type forces a new resource to be created.

  • loadBalancerType - (Required) breadthFirst load balancing distributes new user sessions across all available session hosts in the host pool. Possible values are breadthFirst, depthFirst and persistent. depthFirst load balancing distributes new user sessions to an available session host with the highest number of connections but has not reached its maximum session limit threshold. persistent should be used if the host pool type is personal

  • friendlyName - (Optional) A friendly name for the Virtual Desktop Host Pool.

  • description - (Optional) A description for the Virtual Desktop Host Pool.

  • validateEnvironment - (Optional) Allows you to test service changes before they are deployed to production. Defaults to false.

  • startVmOnConnect - (Optional) Enables or disables the Start VM on Connection Feature. Defaults to false.

  • customRdpProperties - (Optional) A valid custom RDP properties string for the Virtual Desktop Host Pool, available properties can be found in this article.

  • personalDesktopAssignmentType - (Optional) automatic assignment – The service will select an available host and assign it to an user. Possible values are automatic and direct. direct Assignment – Admin selects a specific host to assign to an user. Changing this forces a new resource to be created.

\~> NOTE: personalDesktopAssignmentType is required if the type of your Virtual Desktop Host Pool is personal

  • maximumSessionsAllowed - (Optional) A valid integer value from 0 to 999999 for the maximum number of users that have concurrent sessions on a session host. Should only be set if the type of your Virtual Desktop Host Pool is pooled.

  • preferredAppGroupType - (Optional) Option to specify the preferred Application Group type for the Virtual Desktop Host Pool. Valid options are none, desktop or railApplications. Default is none. Changing this forces a new resource to be created.

  • scheduledAgentUpdates - (Optional) A scheduledAgentUpdates block as defined below. This enables control of when Agent Updates will be applied to Session Hosts.

  • tags - (Optional) A mapping of tags to assign to the resource.


A scheduledAgentUpdates block supports the following:

  • enabled - (Optional) Enables or disables scheduled updates of the AVD agent components (RDAgent, Geneva Monitoring agent, and side-by-side stack) on session hosts. If this is enabled then up to two schedule blocks must be defined. Default is false.

\~> NOTE: if enabled is set to true then at least one and a maximum of two schedule blocks must be provided.

  • timezone - (Optional) Specifies the time zone in which the agent update schedule will apply, the possible values are defined here. If useSessionHostTimezone is enabled then it will override this setting. Default is utc
  • useSessionHostTimezone - (Optional) Specifies whether scheduled agent updates should be applied based on the timezone of the affected session host. If configured then this setting overrides timezone. Default is false.
  • schedule - (Optional) A schedule block as defined below. A maximum of two blocks can be added.


A schedule block supports the following:

  • dayOfWeek - (Required) The day of the week on which agent updates should be performed. Possible values are monday, tuesday, wednesday, thursday, friday, saturday, and sunday
  • hourOfDay - (Required) The hour of day the update window should start. The update is a 2 hour period following the hour provided. The value should be provided as a number between 0 and 23, with 0 being midnight and 23 being 11pm. A leading zero should not be used.

Attributes Reference

In addition to the Arguments listed above - the following Attributes are exported:

  • id - The ID of the Virtual Desktop Host Pool.

Timeouts

The timeouts block allows you to specify timeouts for certain actions:

  • create - (Defaults to 60 minutes) Used when creating the Virtual Desktop Host Pool.
  • update - (Defaults to 60 minutes) Used when updating the Virtual Desktop Host Pool.
  • read - (Defaults to 5 minutes) Used when retrieving the Virtual Desktop Host Pool.
  • delete - (Defaults to 60 minutes) Used when deleting the Virtual Desktop Host Pool.

Import

Virtual Desktop Host Pools can be imported using the resourceId, e.g.

terraform import azurerm_virtual_desktop_host_pool.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup1/providers/Microsoft.DesktopVirtualization/hostPools/myhostpool