Loading...

Public Preview of Attach and Detach of Virtual Machines on Virtual Machine Scale Sets

Image

Today, we’re making it possible to attach a running Virtual Machine (VM) to an existing Virtual Machine Scale Set (VMSS) with no downtime. VMSS customers can now also detach a VM with minimal to no downtime. Attach and detach actions are 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, Automatic 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 architecture 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. Isolation: Should you need more detailed troubleshooting of a VM, you can now detach the VM to isolate it from the scale set.  

When the VM and the VMSS meet all the qualifications, you can quickly attach the VM to the scale set by updating the VM to use the VMSS ID. Use the REST API, Azure Portal, Azure CLI, or Azure PowerShell to update the VMSS ID parameter on the VM. 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 VM to include the VMSS ID $vm.VirtualMachineScaleSetId = $vmss.Id #Update the VM Update-AzVM -ResourceGroupName $resourceGroupName -VM $vm

 

Likewise, to detach the VM, you simply need to update the VM to no longer have a VMSS ID associated with it:

 

#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 is in Public Preview in all regions in public Azure.

 

Learn More

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

Learn more
Author image

Azure Compute Blog articles

Azure Compute Blog articles

Share post:

Related

Stay up to date with latest Microsoft Dynamics 365 and Power Platform news!

* Yes, I agree to the privacy policy