Blog Post

Azure Compute Blog
2 MIN READ

Announcing General Availability of Attach & Detach of Virtual Machines on Virtual Machine Scale Sets

brittanyrowe's avatar
brittanyrowe
Icon for Microsoft rankMicrosoft
Aug 12, 2024

Today, we’re thrilled to announce that the ability to attach or detach Virtual Machines (VMs) to and from a Virtual Machine Scale Set (VMSS) with no downtime is Generally Available. This functionality is available for scale sets with Flexible Orchestration Mode with a Fault Domain Count of 1.

Benefits

  1. Let Azure do the work: Easily move from a single VM to VMSS Flex and make use of all the benefits that come from scale sets, like Autoscale, Auto OS Upgrades, Spot Priority Mix, Instance Repairs, and Upgrade Policies.
  2. Easily scale: By attaching an existing VM to an existing VMSS Flex, you can grow your Compute without having to rebuild it from scratch.
  3. No downtime: You can attach running VMs to a scale set with no downtime, thereby creating a frictionless experience to make use of scale sets.
  4. Isolated troubleshooting: Should you need more detailed troubleshooting of a VM, you can now detach the VM to isolate it from the scale set.
  5. Easily move VMs: Using the feature, you can easily move VMs between scale sets to ensure your VMs are grouped the way you want them to be.

When the VM and VMSS meet all the qualifications, you can quickly attach the VM to the scale set by updating the VM to use the VMSS ID. You can attach VMs through the REST API, Azure Portal, Azure CLI, or Azure PowerShell. For example, using PowerShell:

 

#Get VM information
$vm = Get-AzVM -ResourceGroupName $resourceGroupName -Name $vmName `

#Get scale set information
$vmss = Get-AzVmss -ResourceGroupName $resourceGroupName -Name $vmssName `

#Update the VM with the scale set ID
Update-AzVM -ResourceGroupName $resourceGroupName -VM $vm  -VirtualMachineScaleSetId $vmss.Id

 

 

Conversely, to detach the VM from the scale set, you simply need to update the VM to no longer use a VMSS ID:

 

#Get VM information
$vm = Get-AzVM -ResourceGroupName $resourceGroupName -Name $vmName

#Update the VM with the new scale set refence of $null
Update-AzVM -ResourceGroupName $resourceGroupName -VM $vm -VirtualMachineScaleSetId $null

 

 

Attach and detach of VMs to/from VMSS Flex with a Fault Domain Count of 1 is Generally Available in Azure.

 

Learn More

To learn more about how to attach or detach VMs to or from a VMSS Flex, please visit the documentation.

Updated Aug 09, 2024
Version 1.0
No CommentsBe the first to comment