Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Applies to: ✔️ Uniform scale set ✔️ Flexible scale sets
This article walks you through removing a virtual machine scale set association from a capacity reservation group. To learn more about capacity reservations, see the overview of capacity reservations.
Because both the virtual machine (VM) and the underlying capacity reservation logically occupy capacity, Azure imposes some constraints on this process to avoid ambiguous allocation states and unexpected errors.
There are three ways to change an association:
- Deallocate the virtual machine scale set, change the capacity reservation group property at the scale set level, and then update the underlying VMs.
- Update the reserved quantity to zero and then change the capacity reservation group property.
- Delete the virtual machine scale set
Deallocate the virtual machine scale set
The first option is to deallocate the virtual machine scale set, change the capacity reservation group property at the scale set level, and then update the underlying VMs.
For more information about automatic, rolling, and manual upgrades, see Upgrade policies.
Deallocate the virtual machine scale set:
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{VMScaleSetName}/deallocate?api-version=2021-04-01Update the virtual machine scale set to remove the association with the capacity reservation group:
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{VMScaleSetName}/update?api-version=2021-04-01In the request body, set the
capacityReservationGroupproperty tonullto remove the virtual machine scale set association to the group:{ "location": "eastus", "properties": { "virtualMachineProfile": { "capacityReservation": { "capacityReservationGroup":{ "id":null } } } } }
Update the reserved quantity to zero
The second option involves updating the reserved quantity to zero and then changing the capacity reservation group property.
This option works well when the scale set can't be deallocated and when a reservation is no longer needed. For example, you might create a capacity reservation to temporarily assure capacity during a large-scale deployment. After deployment is finished, the reservation is no longer needed.
For more information about automatic, rolling, and manual upgrades, see Upgrade policies.
Update the reserved quantity to zero:
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/CapacityReservationGroups/{CapacityReservationGroupName}/CapacityReservations/{CapacityReservationName}?api-version=2021-04-01In the request body, include the following parameters:
{ "sku": { "capacity": 0 } }Note that the
capacityproperty is set to0.Update the virtual machine scale set to remove the association with the capacity reservation group.
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{VMScaleSetName}/update?api-version=2021-04-01In the request body, set the
capacityReservationGroupproperty tonullto remove the association:{ "location": "eastus", "properties": { "virtualMachineProfile": { "capacityReservation": { "capacityReservationGroup":{ "id":null } } } } }
Delete the virtual machine scale set
Deletion process of a scale set will remove its association from a capacity reservation. The delete request must complete before Azure removes it from the capacity reservation. Some latency can occur between the delete request and the corresponding change in capacity reservation allocation state. See Delete a VM for more information. Use Capacity Reservation Instance View to check the allocation status as needed.
Upgrade policies
- Automatic upgrade: In this mode, the scale set VM instances are automatically dissociated from the capacity reservation group without any further action from you.
- Rolling upgrade: In this mode, the scale set VM instances are dissociated from the capacity reservation group without any further action from you. However, they're updated in batches with an optional pause time between them.
- Manual upgrade: In this mode, nothing happens to the scale set VM instances when the virtual machine scale set is updated. You need to individually remove each scale set VM by upgrading it with the latest scale set model.