summary import { ComputeManagementClient } from "@msinternal/compute-resource-manager" ; import { DefaultAzureCredential } from "@azure/identity" ; async function listCapacityReservationGroupsInSubscription ( ) { const subscriptionId = "{subscription-id}" ; const expand = "virtualMachines/$ref" ; const options = { expand : expand } ; const credential = new DefaultAzureCredential ( ) ; const client = new ComputeManagementClient ( credential , subscriptionId ) ; const resArray = new Array ( ) ; for await ( let item of client . capacityReservationGroups . listBySubscription ( options ) ) { resArray . push ( item ) ; } console . log ( resArray ) ; } listCapacityReservationGroupsInSubscription ( ) . catch ( console . error ) ;