Citrix Blogs

Fail-safe provisioning on Azure: Leveraging secondary VM configuration support

Machine Creation Services (MCS) now offers Azure Spot VM provisioning, allowing you to take advantage of unused capacity at significant cost savings. In the past, Spot VMs would sometimes get evicted and consequently deleted or deallocated, potentially disrupting user experience. MCS would also at times encounter failures when attempting to provision a VM on Azure with insufficient capacity. To address these challenges, we’ve introduced the capability to have a backup configuration, ensuring a seamless fallback in the event of capacity issues or VM eviction.

In this blog post, I will show you how to set up a backup configuration and outline the prerequisites for choosing the appropriate backup VM size. But first, we’ll go over how to provision Azure Spot VM via machine profile, as that’s key to understanding the backup functionality.

Background on Azure Spot VMs

Spot Virtual Machines enable the provisioning of unused Azure compute capacity at deep discounts, offering up to 90 percent savings compared to pay-as-you-go prices. These Spot VM instances are ideal for workloads that can tolerate interruptions, providing scalability and cost reductions. At any point in time when Azure needs the capacity back, the Azure infrastructure will evict the Spot VM with 30-seconds notice. 

There are two types of evictions for Azure Spot VMs:

Depending on the eviction policy set by the customer, during eviction the VM can be handled in one of two ways:

How to provision a Spot VM

Spot VMs can only be provisioned with a machine profile. Below are the steps for provisioning a Spot VM, either through a Template Spec or directly as a machine profile. 

When using a Template Spec, the highlighted properties should be added under Resources > the VirtualMachines Resource >  Properties:

More information on the template setup can be found here.

When provisioning a Spot VM as a machine profile, select eviction type and eviction policy on the Create Virtual Machine page as shown below.

How to setup backup configuration

To backup a configuration, we introduce a new custom property, BackupVmConfiguration, that can be added to the Provisioning Scheme. This property can also be applied to an existing catalog through Set-ProvScheme. It is essentially a curated list of ServiceOfferings and Types, serving as a fail-safe mechanism. In the event of provisioning failures due to capacity issues or spot evictions, this backup configuration comes into play.

New-ProvScheme -ProvisioningSchemeName “demo” -MasterImageVM “XDHyp:\HostingUnits\azure-zones\image.folder\TestResourceGroup.resourcegroup\TestSnapshot.snapshot” -MachineProfile “XDHyp:\HostingUnits\azure-zones\machineprofile.folder\TestResourceGroup.resourcegroup\TestMachineProfileVM.vm” -CustomProperties“<CustomProperties xmlns=`”http://schemas.citrix.com/2014/xd/machinecreation`” xmlns:xsi=`”http://www.w3.org/2001/XMLSchema-instance`”>
<Property xsi:type=`”StringProperty`” Name=`”BackupVmConfiguration`” Value=`”[{‘ServiceOffering’: ‘Standard_D2as_v4’, ‘Type’: ‘Spot’}, {‘ServiceOffering’: ‘Standard_D2as_v4’, ‘Type’: ‘Regular’}, {‘ServiceOffering’: ‘Standard_D2s_v3’, ‘Type’: ‘Spot’}]`”/>
</CustomProperties>”

Please refer to the Citrix GitHub page for sample PowerShell scripts on applying the BackupVmConfiguration custom property to new and existing provisioning schemes.

The prerequisites to setting up BackupVmConfiguration custom property are as follows:

  1. It is only supported when the machine profile is in use.
  2. ServiceOffering should be Spot compatible. Example: if it’s B-series, Type cannot be Spot. More information can be found here.
  3. Type is optional and when not specified will default to Regular.
  4. A combination of ServiceOffering and Type should be unique in the list.
  5. Regional Quota should have enough cores for ServiceOffering
  6. NIC count should be no greater than MaxNICs allowed on a ServiceOffering
  7. ServiceOffering should be compatible with currently used custom properties and other catalog features such as:

      1. Host Groups: If dedicated hosts are being used, then the hosts in the host group must support the ServiceOffering
      2. Ephemeral OS Disk: If Ephemeral disk is enabled in custom properties, the ServiceOffering must support Ephemeral disks
      3. Premium Storage: If Premium storage is enabled in custom properties, the ServiceOffering must support Premium storage
      4. Accelerated Networking: If Accelerated Networking is enabled in MachineProfile, the ServiceOffering must support Accelerated Networking
      5. DiskEncryptionAtHost: If Encryption at Host is enabled in MachineProfile, the ServiceOffering must support Encryption at Host
      6. Temporary Storage: If the primary VM size specified in the ServiceOffering parameter supports Temporary disk, then the Service Offering input in the Backup list must also support Temporary disks
      7. HyperVGeneration: The selected ServiceOffering must be compatible with the VM generation (Generation 1 or 2) on the resource specified in the MasterImageVM parameter
      8. Hibernation: If Hibernation is enabled in MachineProfile, the ServiceOffering must support Hibernation
      9. TrustedLaunch: If TrustedLaunch is enabled in MachineProfile, the ServiceOffering must support TrustedLaunch
      10. Confidential VMs: If Confidential VM is enabled in MachineProfile, the ServiceOffering must support Confidential VM

BackupVmConfiguration is designed to enhance reliability and ensure continuity in your operations. By implementing this, you can mitigate the risks associated with Spot VM evictions and capacity-related issues.

To apply backup configuration on failure, follow these steps:

This approach ensures a resilient provisioning process, seamlessly transitioning to backup configurations when encountering specific capacity-related issues on Azure.

Special Handling for Secondary Spot Configuration

In summary, this special handling ensures that the provisioning process remains robust and adaptable, whether dealing with Spot or Regular configurations. The system dynamically aligns with the most suitable settings based on the type of backup configuration applied, reverting to the original settings upon a VM restart for consistency.

Learn More

Incorporating backup configurations into your machine catalogs is a strategy that significantly enhances user experience. We highly recommend delving into the potential benefits this configuration can bring to your workloads. For detailed guidance on creating catalogs, refer to our comprehensive product documentation.

Exit mobile version