ScalingPlan

class ScalingPlan : KotlinCustomResource

Manages a Virtual Desktop Scaling Plan.

Disclaimers

Note Scaling Plans are currently in preview and are only supported in a limited number of regions. Both the Scaling Plan and any referenced Host Pools must be deployed in a supported region. Autoscale (preview) for Azure Virtual Desktop host pools. Note Scaling Plans require specific permissions to be granted to the Windows Virtual Desktop application before a 'host_pool' can be configured. Required Permissions for Scaling Plans.

Example Usage

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.random.RandomUuid;
import com.pulumi.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.authorization.RoleDefinition;
import com.pulumi.azure.authorization.RoleDefinitionArgs;
import com.pulumi.azure.authorization.inputs.RoleDefinitionPermissionArgs;
import com.pulumi.azuread.AzureadFunctions;
import com.pulumi.azuread.inputs.GetServicePrincipalArgs;
import com.pulumi.azure.authorization.Assignment;
import com.pulumi.azure.authorization.AssignmentArgs;
import com.pulumi.azure.desktopvirtualization.HostPool;
import com.pulumi.azure.desktopvirtualization.HostPoolArgs;
import com.pulumi.azure.desktopvirtualization.ScalingPlan;
import com.pulumi.azure.desktopvirtualization.ScalingPlanArgs;
import com.pulumi.azure.desktopvirtualization.inputs.ScalingPlanScheduleArgs;
import com.pulumi.azure.desktopvirtualization.inputs.ScalingPlanHostPoolArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var exampleRandomUuid = new RandomUuid("exampleRandomUuid");
var exampleResourceGroup = new ResourceGroup("exampleResourceGroup", ResourceGroupArgs.builder()
.location("West Europe")
.build());
var exampleRoleDefinition = new RoleDefinition("exampleRoleDefinition", RoleDefinitionArgs.builder()
.scope(exampleResourceGroup.id())
.description("AVD AutoScale Role")
.permissions(RoleDefinitionPermissionArgs.builder()
.actions(
"Microsoft.Insights/eventtypes/values/read",
"Microsoft.Compute/virtualMachines/deallocate/action",
"Microsoft.Compute/virtualMachines/restart/action",
"Microsoft.Compute/virtualMachines/powerOff/action",
"Microsoft.Compute/virtualMachines/start/action",
"Microsoft.Compute/virtualMachines/read",
"Microsoft.DesktopVirtualization/hostpools/read",
"Microsoft.DesktopVirtualization/hostpools/write",
"Microsoft.DesktopVirtualization/hostpools/sessionhosts/read",
"Microsoft.DesktopVirtualization/hostpools/sessionhosts/write",
"Microsoft.DesktopVirtualization/hostpools/sessionhosts/usersessions/delete",
"Microsoft.DesktopVirtualization/hostpools/sessionhosts/usersessions/read",
"Microsoft.DesktopVirtualization/hostpools/sessionhosts/usersessions/sendMessage/action",
"Microsoft.DesktopVirtualization/hostpools/sessionhosts/usersessions/read")
.notActions()
.build())
.assignableScopes(exampleResourceGroup.id())
.build());
final var exampleServicePrincipal = AzureadFunctions.getServicePrincipal(GetServicePrincipalArgs.builder()
.displayName("Windows Virtual Desktop")
.build());
var exampleAssignment = new Assignment("exampleAssignment", AssignmentArgs.builder()
.name(exampleRandomUuid.result())
.scope(exampleResourceGroup.id())
.roleDefinitionId(exampleRoleDefinition.roleDefinitionResourceId())
.principalId(exampleServicePrincipal.applyValue(getServicePrincipalResult -> getServicePrincipalResult.id()))
.skipServicePrincipalAadCheck(true)
.build());
var exampleHostPool = new HostPool("exampleHostPool", HostPoolArgs.builder()
.location(exampleResourceGroup.location())
.resourceGroupName(exampleResourceGroup.name())
.type("Pooled")
.validateEnvironment(true)
.loadBalancerType("BreadthFirst")
.build());
var exampleScalingPlan = new ScalingPlan("exampleScalingPlan", ScalingPlanArgs.builder()
.location(exampleResourceGroup.location())
.resourceGroupName(exampleResourceGroup.name())
.friendlyName("Scaling Plan Example")
.description("Example Scaling Plan")
.timeZone("GMT Standard Time")
.schedules(ScalingPlanScheduleArgs.builder()
.name("Weekdays")
.daysOfWeeks(
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday")
.rampUpStartTime("05:00")
.rampUpLoadBalancingAlgorithm("BreadthFirst")
.rampUpMinimumHostsPercent(20)
.rampUpCapacityThresholdPercent(10)
.peakStartTime("09:00")
.peakLoadBalancingAlgorithm("BreadthFirst")
.rampDownStartTime("19:00")
.rampDownLoadBalancingAlgorithm("DepthFirst")
.rampDownMinimumHostsPercent(10)
.rampDownForceLogoffUsers(false)
.rampDownWaitTimeMinutes(45)
.rampDownNotificationMessage("Please log off in the next 45 minutes...")
.rampDownCapacityThresholdPercent(5)
.rampDownStopHostsWhen("ZeroSessions")
.offPeakStartTime("22:00")
.offPeakLoadBalancingAlgorithm("DepthFirst")
.build())
.hostPools(ScalingPlanHostPoolArgs.builder()
.hostpoolId(exampleHostPool.id())
.scalingPlanEnabled(true)
.build())
.build());
}
}

Import

Virtual Desktop Scaling Plans can be imported using the resource id, e.g.

$ pulumi import azure:desktopvirtualization/scalingPlan:ScalingPlan example /subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DesktopVirtualization/scalingPlans/plan1

Properties

Link copied to clipboard
val description: Output<String>?

A description of the Scaling Plan.

Link copied to clipboard
val exclusionTag: Output<String>?

The name of the tag associated with the VMs you want to exclude from autoscaling.

Link copied to clipboard
val friendlyName: Output<String>?

Friendly name of the Scaling Plan.

Link copied to clipboard

One or more host_pool blocks as defined below.

Link copied to clipboard
val id: Output<String>
Link copied to clipboard
val location: Output<String>

The Azure Region where the Virtual Desktop Scaling Plan should exist. Changing this forces a new Virtual Desktop Scaling Plan to be created.

Link copied to clipboard
val name: Output<String>

The name which should be used for this Virtual Desktop Scaling Plan . Changing this forces a new Virtual Desktop Scaling Plan to be created.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The name of the Resource Group where the Virtual Desktop Scaling Plan should exist. Changing this forces a new Virtual Desktop Scaling Plan to be created.

Link copied to clipboard

One or more schedule blocks as defined below.

Link copied to clipboard
val tags: Output<Map<String, String>>?

A mapping of tags which should be assigned to the Virtual Desktop Scaling Plan .

Link copied to clipboard
val timeZone: Output<String>

Specifies the Time Zone which should be used by the Scaling Plan for time based events, the possible values are defined here.

Link copied to clipboard
val urn: Output<String>