Capacity Reservation Groups - List By Resource Group

Lists all of the capacity reservation groups in the specified resource group. Use the nextLink property in the response to get the next page of capacity reservation groups.

GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups?api-version=2024-03-01
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups?api-version=2024-03-01&$expand={$expand}

URI Parameters

Name In Required Type Description
resourceGroupName
path True

string

The name of the resource group.

subscriptionId
path True

string

Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.

api-version
query True

string

Client Api Version.

$expand
query

ExpandTypesForGetCapacityReservationGroups

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.

Responses

Name Type Description
200 OK

CapacityReservationGroupListResult

OK

Other Status Codes

CloudError

Error response describing why the operation failed.

Security

azure_auth

Azure Active Directory OAuth2 Flow

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

Name Description
user_impersonation impersonate your user account

Examples

List capacity reservation groups in resource group.

Sample Request

GET https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups?api-version=2024-03-01&$expand=virtualMachines/$ref

Sample Response

{
  "value": [
    {
      "name": "{capacityReservationGroupName}",
      "id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}",
      "type": "Microsoft.Compute/CapacityReservationGroups",
      "location": "West US",
      "properties": {
        "capacityReservations": [
          {
            "id": "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/myCapacityReservationGroup/capacityReservations/myCapacityReservation1"
          },
          {
            "id": "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/myCapacityReservationGroup/capacityReservations/myCapacityReservation2"
          }
        ],
        "virtualMachinesAssociated": [
          {
            "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM1"
          },
          {
            "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM2"
          }
        ]
      }
    },
    {
      "name": "{capacityReservationGroupName}",
      "id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}",
      "type": "Microsoft.Compute/CapacityReservationGroups",
      "location": "West US",
      "properties": {
        "capacityReservations": [
          {
            "id": "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/myCapacityReservationGroup/capacityReservations/myCapacityReservation3"
          },
          {
            "id": "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/capacityReservationGroups/myCapacityReservationGroup/capacityReservations/myCapacityReservation4"
          }
        ],
        "virtualMachinesAssociated": [
          {
            "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM3"
          }
        ]
      }
    }
  ]
}

Definitions

Name Description
ApiError

Api error.

ApiErrorBase

Api error base.

CapacityReservationGroup

Specifies information about the capacity reservation group that the capacity reservations should be assigned to. Currently, a capacity reservation can only be added to a capacity reservation group at creation time. An existing capacity reservation cannot be added or moved to another capacity reservation group.

CapacityReservationGroupInstanceView
CapacityReservationGroupListResult

The List capacity reservation group with resource group response.

CapacityReservationInstanceViewWithName

The instance view of a capacity reservation that includes the name of the capacity reservation. It is used for the response to the instance view of a capacity reservation group.

CapacityReservationUtilization

Represents the capacity reservation utilization in terms of resources allocated.

CloudError

An error response from the Compute service.

ExpandTypesForGetCapacityReservationGroups

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.

InnerError

Inner error details.

InstanceViewStatus

Instance view status.

ResourceSharingProfile
StatusLevelTypes

The level code.

SubResource
SubResourceReadOnly

ApiError

Api error.

Name Type Description
code

string

The error code.

details

ApiErrorBase[]

The Api error details

innererror

InnerError

The Api inner error

message

string

The error message.

target

string

The target of the particular error.

ApiErrorBase

Api error base.

Name Type Description
code

string

The error code.

message

string

The error message.

target

string

The target of the particular error.

CapacityReservationGroup

Specifies information about the capacity reservation group that the capacity reservations should be assigned to. Currently, a capacity reservation can only be added to a capacity reservation group at creation time. An existing capacity reservation cannot be added or moved to another capacity reservation group.

Name Type Description
id

string

Resource Id

location

string

Resource location

name

string

Resource name

properties.capacityReservations

SubResourceReadOnly[]

A list of all capacity reservation resource ids that belong to capacity reservation group.

properties.instanceView

CapacityReservationGroupInstanceView

The capacity reservation group instance view which has the list of instance views for all the capacity reservations that belong to the capacity reservation group.

properties.sharingProfile

ResourceSharingProfile

Specifies the settings to enable sharing across subscriptions for the capacity reservation group resource. Pls. keep in mind the capacity reservation group resource generally can be shared across subscriptions belonging to a single azure AAD tenant or cross AAD tenant if there is a trust relationship established between the AAD tenants. Note: Minimum api-version: 2024-03-01. Please refer to https://aka.ms/computereservationsharing for more details.

properties.virtualMachinesAssociated

SubResourceReadOnly[]

A list of references to all virtual machines associated to the capacity reservation group.

tags

object

Resource tags

type

string

Resource type

zones

string[]

Availability Zones to use for this capacity reservation group. The zones can be assigned only during creation. If not provided, the group supports only regional resources in the region. If provided, enforces each capacity reservation in the group to be in one of the zones.

CapacityReservationGroupInstanceView

Name Type Description
capacityReservations

CapacityReservationInstanceViewWithName[]

List of instance view of the capacity reservations under the capacity reservation group.

sharedSubscriptionIds

SubResourceReadOnly[]

List of the subscriptions that the capacity reservation group is shared with. Note: Minimum api-version: 2024-03-01. Please refer to https://aka.ms/computereservationsharing for more details.

CapacityReservationGroupListResult

The List capacity reservation group with resource group response.

Name Type Description
nextLink

string

The URI to fetch the next page of capacity reservation groups. Call ListNext() with this URI to fetch the next page of capacity reservation groups.

value

CapacityReservationGroup[]

The list of capacity reservation groups

CapacityReservationInstanceViewWithName

The instance view of a capacity reservation that includes the name of the capacity reservation. It is used for the response to the instance view of a capacity reservation group.

Name Type Description
name

string

The name of the capacity reservation.

statuses

InstanceViewStatus[]

The resource status information.

utilizationInfo

CapacityReservationUtilization

Unutilized capacity of the capacity reservation.

CapacityReservationUtilization

Represents the capacity reservation utilization in terms of resources allocated.

Name Type Description
currentCapacity

integer

The value provides the current capacity of the VM size which was reserved successfully and for which the customer is getting billed. Minimum api-version: 2022-08-01.

virtualMachinesAllocated

SubResourceReadOnly[]

A list of all virtual machines resource ids allocated against the capacity reservation.

CloudError

An error response from the Compute service.

Name Type Description
error

ApiError

Api error.

ExpandTypesForGetCapacityReservationGroups

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.

Name Type Description
virtualMachineScaleSetVMs/$ref

string

virtualMachines/$ref

string

InnerError

Inner error details.

Name Type Description
errordetail

string

The internal error message or exception dump.

exceptiontype

string

The exception type.

InstanceViewStatus

Instance view status.

Name Type Description
code

string

The status code.

displayStatus

string

The short localizable label for the status.

level

StatusLevelTypes

The level code.

message

string

The detailed status message, including for alerts and error messages.

time

string

The time of the status.

ResourceSharingProfile

Name Type Description
subscriptionIds

SubResource[]

Specifies an array of subscription resource IDs that capacity reservation group is shared with. Note: Minimum api-version: 2024-03-01. Please refer to https://aka.ms/computereservationsharing for more details.

StatusLevelTypes

The level code.

Name Type Description
Error

string

Info

string

Warning

string

SubResource

Name Type Description
id

string

Resource Id

SubResourceReadOnly

Name Type Description
id

string

Resource Id