capacity_reservations
Creates, updates, deletes, gets or lists a capacity_reservations resource.
Overview
| Name | capacity_reservations |
| Type | Resource |
| Id | azure.compute.capacity_reservations |
Fields
The following fields are returned by SELECT queries:
- get
- list_by_capacity_reservation_group
| Name | Datatype | Description |
|---|---|---|
id | string | Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. |
name | string | The name of the resource. |
instanceView | object | The Capacity reservation instance view. |
location | string | The geo-location where the resource lives. Required. |
platformFaultDomainCount | integer | Specifies 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. |
provisioningState | string | The provisioning state, which only appears in the response. |
provisioningTime | string (date-time) | The date time when the capacity reservation was last updated. |
reservationId | string | A unique id generated and assigned to the capacity reservation by the platform which does not change throughout the lifetime of the resource. |
scheduleProfile | object | Defines 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. |
sku | object | SKU 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. |
systemData | object | Azure Resource Manager metadata containing createdBy and modifiedBy information. |
tags | object | Resource tags. |
timeCreated | string (date-time) | Specifies the time at which the Capacity Reservation resource was created. Minimum api-version: 2021-11-01. |
type | string | The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". |
virtualMachinesAssociated | array | A list of all virtual machine resource ids that are associated with the capacity reservation. |
zones | array | The availability zones. |
| Name | Datatype | Description |
|---|---|---|
id | string | Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. |
name | string | The name of the resource. |
instanceView | object | The Capacity reservation instance view. |
location | string | The geo-location where the resource lives. Required. |
platformFaultDomainCount | integer | Specifies 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. |
provisioningState | string | The provisioning state, which only appears in the response. |
provisioningTime | string (date-time) | The date time when the capacity reservation was last updated. |
reservationId | string | A unique id generated and assigned to the capacity reservation by the platform which does not change throughout the lifetime of the resource. |
scheduleProfile | object | Defines 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. |
sku | object | SKU 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. |
systemData | object | Azure Resource Manager metadata containing createdBy and modifiedBy information. |
tags | object | Resource tags. |
timeCreated | string (date-time) | Specifies the time at which the Capacity Reservation resource was created. Minimum api-version: 2021-11-01. |
type | string | The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". |
virtualMachinesAssociated | array | A list of all virtual machine resource ids that are associated with the capacity reservation. |
zones | array | The availability zones. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | resource_group_name, capacity_reservation_group_name, capacity_reservation_name, subscription_id | $expand | The operation that retrieves information about the capacity reservation. |
list_by_capacity_reservation_group | select | resource_group_name, capacity_reservation_group_name, subscription_id | $expand | Lists 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_update | insert | resource_group_name, capacity_reservation_group_name, capacity_reservation_name, subscription_id, location, sku | 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. | |
update | update | resource_group_name, capacity_reservation_group_name, capacity_reservation_name, subscription_id | The operation to update a capacity reservation. | |
create_or_update | replace | resource_group_name, capacity_reservation_group_name, capacity_reservation_name, subscription_id, location, sku | 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. | |
delete | delete | resource_group_name, capacity_reservation_group_name, capacity_reservation_name, subscription_id | 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. |
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.
| Name | Datatype | Description |
|---|---|---|
capacity_reservation_group_name | string | The name of the capacity reservation group. Required. |
capacity_reservation_name | string | The name of the capacity reservation. Required. |
resource_group_name | string | The name of the resource group. The name is case insensitive. Required. |
subscription_id | string | |
$expand | string | The 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
- get
- list_by_capacity_reservation_group
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 }}'
;
Lists 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.
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 subscription_id = '{{ subscription_id }}' -- required
AND $expand = '{{ $expand }}'
;
INSERT examples
- create_or_update
- Manifest
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
;
# Description fields are for documentation purposes
- name: capacity_reservations
props:
- name: resource_group_name
value: "{{ resource_group_name }}"
description: Required parameter for the capacity_reservations resource.
- name: capacity_reservation_group_name
value: "{{ capacity_reservation_group_name }}"
description: Required parameter for the capacity_reservations resource.
- name: capacity_reservation_name
value: "{{ capacity_reservation_name }}"
description: Required parameter for the capacity_reservations resource.
- name: subscription_id
value: "{{ subscription_id }}"
description: Required parameter for the capacity_reservations resource.
- name: tags
value: "{{ tags }}"
description: |
Resource tags.
- name: location
value: "{{ location }}"
description: |
The geo-location where the resource lives. Required.
- name: properties
description: |
Properties of the Capacity reservation.
value:
reservationId: "{{ reservationId }}"
platformFaultDomainCount: {{ platformFaultDomainCount }}
virtualMachinesAssociated:
- id: "{{ id }}"
provisioningTime: "{{ provisioningTime }}"
provisioningState: "{{ provisioningState }}"
instanceView:
utilizationInfo:
currentCapacity: {{ currentCapacity }}
virtualMachinesAllocated:
- id: "{{ id }}"
statuses:
- code: "{{ code }}"
level: "{{ level }}"
displayStatus: "{{ displayStatus }}"
message: "{{ message }}"
time: "{{ time }}"
timeCreated: "{{ timeCreated }}"
scheduleProfile:
start: "{{ start }}"
end: "{{ end }}"
- name: sku
description: |
SKU 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.
value:
name: "{{ name }}"
tier: "{{ tier }}"
capacity: {{ capacity }}
- name: zones
value:
- "{{ zones }}"
description: |
The availability zones.
UPDATE examples
- update
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
- create_or_update
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
- delete
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
;