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
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.