Skip to main content

capacity_reservations

Creates, updates, deletes, gets or lists a capacity_reservations resource.

Overview

Namecapacity_reservations
TypeResource
Idazure.compute.capacity_reservations

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringFully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
namestringThe name of the resource.
instanceViewobjectThe Capacity reservation instance view.
locationstringThe geo-location where the resource lives. Required.
platformFaultDomainCountintegerSpecifies the value of fault domain count that Capacity Reservation supports for requested VM size. Note: The fault domain count specified for a resource (like virtual machines scale set) must be less than or equal to this value if it deploys using capacity reservation. Minimum api-version: 2022-08-01.
provisioningStatestringThe provisioning state, which only appears in the response.
provisioningTimestring (date-time)The date time when the capacity reservation was last updated.
reservationIdstringA unique id generated and assigned to the capacity reservation by the platform which does not change throughout the lifetime of the resource.
scheduleProfileobjectDefines the schedule for Block-type capacity reservations. Specifies the schedule during which capacity reservation is active and VM or VMSS resource can be allocated using reservation. This property is required and only supported when the capacity reservation group type is 'Block'. The scheduleProfile, start, and end fields are immutable after creation. Minimum API version: 2025-04-01. Please refer to https://aka.ms/blockcapacityreservation _ for more details.
skuobjectSKU of the resource for which capacity needs be reserved. The SKU name and capacity is required to be set. For Block capacity reservations, sku.capacity can only accept values 1, 2, 4, 8, 16, 32, 64. Currently VM Skus with the capability called 'CapacityReservationSupported' set to true are supported. When 'CapacityReservationSupported' is true, the SKU capability also specifies the 'SupportedCapacityReservationTypes', which lists the types of capacity reservations (such as Targeted or Block) that the SKU supports. Refer to List Microsoft.Compute SKUs in a region (https://docs.microsoft.com/rest/api/compute/resourceskus/list _) for supported values. Required.
systemDataobjectAzure Resource Manager metadata containing createdBy and modifiedBy information.
tagsobjectResource tags.
timeCreatedstring (date-time)Specifies the time at which the Capacity Reservation resource was created. Minimum api-version: 2021-11-01.
typestringThe type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts".
virtualMachinesAssociatedarrayA list of all virtual machine resource ids that are associated with the capacity reservation.
zonesarrayThe availability zones.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectresource_group_name, capacity_reservation_group_name, capacity_reservation_name, subscription_id$expandThe operation that retrieves information about the capacity reservation.
list_by_capacity_reservation_groupselectresource_group_name, capacity_reservation_group_name, subscription_id$expandLists all of the capacity reservations in the specified capacity reservation group. Use the nextLink property in the response to get the next page of capacity reservations.
create_or_updateinsertresource_group_name, capacity_reservation_group_name, capacity_reservation_name, subscription_id, location, skuThe operation to create or update a capacity reservation. Please note some properties can be set only during capacity reservation creation. Please refer to https://aka.ms/CapacityReservation _ for more details.
updateupdateresource_group_name, capacity_reservation_group_name, capacity_reservation_name, subscription_idThe operation to update a capacity reservation.
create_or_updatereplaceresource_group_name, capacity_reservation_group_name, capacity_reservation_name, subscription_id, location, skuThe operation to create or update a capacity reservation. Please note some properties can be set only during capacity reservation creation. Please refer to https://aka.ms/CapacityReservation _ for more details.
deletedeleteresource_group_name, capacity_reservation_group_name, capacity_reservation_name, subscription_idThe operation to delete a capacity reservation. This operation is allowed only when all the associated resources are disassociated from the capacity reservation. Please refer to https://aka.ms/CapacityReservation _ for more details. Note: Block capacity reservations cannot be deleted after it has been successfully allocated until the schedule end time.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
capacity_reservation_group_namestringThe name of the capacity reservation group. Required.
capacity_reservation_namestringThe name of the capacity reservation. Required.
resource_group_namestringThe name of the resource group. The name is case insensitive. Required.
subscription_idstring
$expandstringThe expand expression to apply on the operation. Based on the expand param(s) specified we return Virtual Machine or ScaleSet VM Instance or both resource Ids which are associated to capacity reservation group in the response. Known values are: "virtualMachineScaleSetVMs/$ref" and "virtualMachines/$ref". Default value is None.

SELECT examples

The operation that retrieves information about the capacity reservation.

SELECT
id,
name,
instanceView,
location,
platformFaultDomainCount,
provisioningState,
provisioningTime,
reservationId,
scheduleProfile,
sku,
systemData,
tags,
timeCreated,
type,
virtualMachinesAssociated,
zones
FROM azure.compute.capacity_reservations
WHERE resource_group_name = '{{ resource_group_name }}' -- required
AND capacity_reservation_group_name = '{{ capacity_reservation_group_name }}' -- required
AND capacity_reservation_name = '{{ capacity_reservation_name }}' -- required
AND subscription_id = '{{ subscription_id }}' -- required
AND $expand = '{{ $expand }}'
;

INSERT examples

The operation to create or update a capacity reservation. Please note some properties can be set only during capacity reservation creation. Please refer to https://aka.ms/CapacityReservation _ for more details.

INSERT INTO azure.compute.capacity_reservations (
tags,
location,
properties,
sku,
zones,
resource_group_name,
capacity_reservation_group_name,
capacity_reservation_name,
subscription_id
)
SELECT
'{{ tags }}',
'{{ location }}' /* required */,
'{{ properties }}',
'{{ sku }}' /* required */,
'{{ zones }}',
'{{ resource_group_name }}',
'{{ capacity_reservation_group_name }}',
'{{ capacity_reservation_name }}',
'{{ subscription_id }}'
RETURNING
id,
name,
location,
properties,
sku,
systemData,
tags,
type,
zones
;

UPDATE examples

The operation to update a capacity reservation.

UPDATE azure.compute.capacity_reservations
SET
tags = '{{ tags }}',
properties = '{{ properties }}',
sku = '{{ sku }}'
WHERE
resource_group_name = '{{ resource_group_name }}' --required
AND capacity_reservation_group_name = '{{ capacity_reservation_group_name }}' --required
AND capacity_reservation_name = '{{ capacity_reservation_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
RETURNING
id,
name,
location,
properties,
sku,
systemData,
tags,
type,
zones;

REPLACE examples

The operation to create or update a capacity reservation. Please note some properties can be set only during capacity reservation creation. Please refer to https://aka.ms/CapacityReservation _ for more details.

REPLACE azure.compute.capacity_reservations
SET
tags = '{{ tags }}',
location = '{{ location }}',
properties = '{{ properties }}',
sku = '{{ sku }}',
zones = '{{ zones }}'
WHERE
resource_group_name = '{{ resource_group_name }}' --required
AND capacity_reservation_group_name = '{{ capacity_reservation_group_name }}' --required
AND capacity_reservation_name = '{{ capacity_reservation_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
AND location = '{{ location }}' --required
AND sku = '{{ sku }}' --required
RETURNING
id,
name,
location,
properties,
sku,
systemData,
tags,
type,
zones;

DELETE examples

The operation to delete a capacity reservation. This operation is allowed only when all the associated resources are disassociated from the capacity reservation. Please refer to https://aka.ms/CapacityReservation _ for more details. Note: Block capacity reservations cannot be deleted after it has been successfully allocated until the schedule end time.

DELETE FROM azure.compute.capacity_reservations
WHERE resource_group_name = '{{ resource_group_name }}' --required
AND capacity_reservation_group_name = '{{ capacity_reservation_group_name }}' --required
AND capacity_reservation_name = '{{ capacity_reservation_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
;