Lists all of the dedicated host groups in the subscription. Use the nextLink property in the response to get the next page of dedicated host groups.
GET https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Compute/hostGroups?api-version=2023-07-01
URI Parameters
Name |
In |
Required |
Type |
Description |
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.
|
Responses
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
DedicatedHostGroup_ListBySubscription_MaximumSet_Gen
Sample Request
GET https://management.azure.com/subscriptions/{subscription-id}/providers/Microsoft.Compute/hostGroups?api-version=2023-07-01
/** Samples for DedicatedHostGroups List. */
public final class Main {
/*
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/dedicatedHostExamples/DedicatedHostGroup_ListBySubscription_MaximumSet_Gen.json
*/
/**
* Sample code: DedicatedHostGroup_ListBySubscription_MaximumSet_Gen.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void dedicatedHostGroupListBySubscriptionMaximumSetGen(
com.azure.resourcemanager.AzureResourceManager azure) {
azure
.virtualMachines()
.manager()
.serviceClient()
.getDedicatedHostGroups()
.list(com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.compute import ComputeManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-compute
# USAGE
python dedicated_host_group_list_by_subscription_maximum_set_gen.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ComputeManagementClient(
credential=DefaultAzureCredential(),
subscription_id="{subscription-id}",
)
response = client.dedicated_host_groups.list_by_subscription()
for item in response:
print(item)
# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/dedicatedHostExamples/DedicatedHostGroup_ListBySubscription_MaximumSet_Gen.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcompute_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/dedicatedHostExamples/DedicatedHostGroup_ListBySubscription_MaximumSet_Gen.json
func ExampleDedicatedHostGroupsClient_NewListBySubscriptionPager_dedicatedHostGroupListBySubscriptionMaximumSetGen() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewDedicatedHostGroupsClient().NewListBySubscriptionPager(nil)
for pager.More() {
page, err := pager.NextPage(ctx)
if err != nil {
log.Fatalf("failed to advance page: %v", err)
}
for _, v := range page.Value {
// You could use page here. We use blank identifier for just demo purposes.
_ = v
}
// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// page.DedicatedHostGroupListResult = armcompute.DedicatedHostGroupListResult{
// Value: []*armcompute.DedicatedHostGroup{
// {
// Name: to.Ptr("myDedicatedHostGroup"),
// Type: to.Ptr("aaaa"),
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/HostGroups/myDedicatedHostGroup"),
// Location: to.Ptr("westus"),
// Tags: map[string]*string{
// },
// Properties: &armcompute.DedicatedHostGroupProperties{
// Hosts: []*armcompute.SubResourceReadOnly{
// {
// ID: to.Ptr("aaaa"),
// }},
// InstanceView: &armcompute.DedicatedHostGroupInstanceView{
// Hosts: []*armcompute.DedicatedHostInstanceViewWithName{
// {
// AssetID: to.Ptr("aaaa"),
// AvailableCapacity: &armcompute.DedicatedHostAvailableCapacity{
// AllocatableVMs: []*armcompute.DedicatedHostAllocatableVM{
// {
// Count: to.Ptr[float64](26),
// VMSize: to.Ptr("aaaaaaaaaaaaaaaaaaaa"),
// }},
// },
// Statuses: []*armcompute.InstanceViewStatus{
// {
// Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"),
// DisplayStatus: to.Ptr("aaaaaa"),
// Level: to.Ptr(armcompute.StatusLevelTypesInfo),
// Message: to.Ptr("a"),
// Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-30T12:58:26.522Z"); return t}()),
// }},
// Name: to.Ptr("aaaaaaaaaaaaaaaaaa"),
// }},
// },
// PlatformFaultDomainCount: to.Ptr[int32](3),
// SupportAutomaticPlacement: to.Ptr(true),
// },
// Zones: []*string{
// to.Ptr("1")},
// }},
// }
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ComputeManagementClient } = require("@azure/arm-compute");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Lists all of the dedicated host groups in the subscription. Use the nextLink property in the response to get the next page of dedicated host groups.
*
* @summary Lists all of the dedicated host groups in the subscription. Use the nextLink property in the response to get the next page of dedicated host groups.
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/dedicatedHostExamples/DedicatedHostGroup_ListBySubscription_MaximumSet_Gen.json
*/
async function dedicatedHostGroupListBySubscriptionMaximumSetGen() {
const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}";
const credential = new DefaultAzureCredential();
const client = new ComputeManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.dedicatedHostGroups.listBySubscription()) {
resArray.push(item);
}
console.log(resArray);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Compute;
using Azure.ResourceManager.Compute.Models;
using Azure.ResourceManager.Resources;
// Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/dedicatedHostExamples/DedicatedHostGroup_ListBySubscription_MaximumSet_Gen.json
// this example is just showing the usage of "DedicatedHostGroups_ListBySubscription" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this SubscriptionResource created on azure
// for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource
string subscriptionId = "{subscription-id}";
ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId);
SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId);
// invoke the operation and iterate over the result
await foreach (DedicatedHostGroupResource item in subscriptionResource.GetDedicatedHostGroupsAsync())
{
// the variable item is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
DedicatedHostGroupData resourceData = item.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
}
Console.WriteLine($"Succeeded");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
{
"value": [
{
"location": "westus",
"tags": {},
"zones": [
"1"
],
"properties": {
"platformFaultDomainCount": 3,
"supportAutomaticPlacement": true,
"hosts": [
{
"id": "aaaa"
}
],
"instanceView": {
"hosts": [
{
"name": "aaaaaaaaaaaaaaaaaa",
"assetId": "aaaa",
"availableCapacity": {
"allocatableVMs": [
{
"vmSize": "aaaaaaaaaaaaaaaaaaaa",
"count": 26
}
]
},
"statuses": [
{
"code": "aaaaaaaaaaaaaaaaaaaaaaa",
"level": "Info",
"displayStatus": "aaaaaa",
"message": "a",
"time": "2021-11-30T12:58:26.522Z"
}
]
}
]
}
},
"id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/HostGroups/myDedicatedHostGroup",
"name": "myDedicatedHostGroup",
"type": "aaaa"
}
],
"nextLink": "aaaaaaaaaaaaaaaaaaaaaaaaaaa"
}
DedicatedHostGroup_ListBySubscription_MinimumSet_Gen
Sample Request
GET https://management.azure.com/subscriptions/{subscription-id}/providers/Microsoft.Compute/hostGroups?api-version=2023-07-01
/** Samples for DedicatedHostGroups List. */
public final class Main {
/*
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/dedicatedHostExamples/DedicatedHostGroup_ListBySubscription_MinimumSet_Gen.json
*/
/**
* Sample code: DedicatedHostGroup_ListBySubscription_MinimumSet_Gen.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void dedicatedHostGroupListBySubscriptionMinimumSetGen(
com.azure.resourcemanager.AzureResourceManager azure) {
azure
.virtualMachines()
.manager()
.serviceClient()
.getDedicatedHostGroups()
.list(com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.compute import ComputeManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-compute
# USAGE
python dedicated_host_group_list_by_subscription_minimum_set_gen.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ComputeManagementClient(
credential=DefaultAzureCredential(),
subscription_id="{subscription-id}",
)
response = client.dedicated_host_groups.list_by_subscription()
for item in response:
print(item)
# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/dedicatedHostExamples/DedicatedHostGroup_ListBySubscription_MinimumSet_Gen.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcompute_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c78b5d8bd3aff2d82a5f034d9164b1a9ac030e09/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/dedicatedHostExamples/DedicatedHostGroup_ListBySubscription_MinimumSet_Gen.json
func ExampleDedicatedHostGroupsClient_NewListBySubscriptionPager_dedicatedHostGroupListBySubscriptionMinimumSetGen() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewDedicatedHostGroupsClient().NewListBySubscriptionPager(nil)
for pager.More() {
page, err := pager.NextPage(ctx)
if err != nil {
log.Fatalf("failed to advance page: %v", err)
}
for _, v := range page.Value {
// You could use page here. We use blank identifier for just demo purposes.
_ = v
}
// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// page.DedicatedHostGroupListResult = armcompute.DedicatedHostGroupListResult{
// Value: []*armcompute.DedicatedHostGroup{
// {
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/HostGroups/myDedicatedHostGroup"),
// Location: to.Ptr("westus"),
// }},
// }
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ComputeManagementClient } = require("@azure/arm-compute");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Lists all of the dedicated host groups in the subscription. Use the nextLink property in the response to get the next page of dedicated host groups.
*
* @summary Lists all of the dedicated host groups in the subscription. Use the nextLink property in the response to get the next page of dedicated host groups.
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/dedicatedHostExamples/DedicatedHostGroup_ListBySubscription_MinimumSet_Gen.json
*/
async function dedicatedHostGroupListBySubscriptionMinimumSetGen() {
const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}";
const credential = new DefaultAzureCredential();
const client = new ComputeManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.dedicatedHostGroups.listBySubscription()) {
resArray.push(item);
}
console.log(resArray);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Compute;
using Azure.ResourceManager.Compute.Models;
using Azure.ResourceManager.Resources;
// Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/dedicatedHostExamples/DedicatedHostGroup_ListBySubscription_MinimumSet_Gen.json
// this example is just showing the usage of "DedicatedHostGroups_ListBySubscription" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this SubscriptionResource created on azure
// for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource
string subscriptionId = "{subscription-id}";
ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId);
SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId);
// invoke the operation and iterate over the result
await foreach (DedicatedHostGroupResource item in subscriptionResource.GetDedicatedHostGroupsAsync())
{
// the variable item is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
DedicatedHostGroupData resourceData = item.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
}
Console.WriteLine($"Succeeded");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
{
"value": [
{
"location": "westus",
"id": "/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/HostGroups/myDedicatedHostGroup"
}
]
}
Definitions
AdditionalCapabilities
Enables or disables a capability on the dedicated host group. Minimum api-version: 2022-03-01.
Name |
Type |
Description |
ultraSSDEnabled
|
boolean
|
The flag that enables or disables a capability to have UltraSSD Enabled Virtual Machines on Dedicated Hosts of the Dedicated Host Group. For the Virtual Machines to be UltraSSD Enabled, UltraSSDEnabled flag for the resource needs to be set true as well. The value is defaulted to 'false' when not provided. Please refer to https://docs.microsoft.com/en-us/azure/virtual-machines/disks-enable-ultra-ssd for more details on Ultra SSD feature. Note: The ultraSSDEnabled setting can only be enabled for Host Groups that are created as zonal. Minimum api-version: 2022-03-01.
|
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.
|
CloudError
An error response from the Compute service.
Name |
Type |
Description |
error
|
ApiError
|
Api error.
|
DedicatedHostAllocatableVM
Represents the dedicated host unutilized capacity in terms of a specific VM size.
Name |
Type |
Description |
count
|
number
|
Maximum number of VMs of size vmSize that can fit in the dedicated host's remaining capacity.
|
vmSize
|
string
|
VM size in terms of which the unutilized capacity is represented.
|
DedicatedHostAvailableCapacity
Dedicated host unutilized capacity.
Name |
Type |
Description |
allocatableVMs
|
DedicatedHostAllocatableVM[]
|
The unutilized capacity of the dedicated host represented in terms of each VM size that is allowed to be deployed to the dedicated host.
|
DedicatedHostGroup
Specifies information about the dedicated host group that the dedicated hosts should be assigned to. Currently, a dedicated host can only be added to a dedicated host group at creation time. An existing dedicated host cannot be added to another dedicated host group.
Name |
Type |
Description |
id
|
string
|
Resource Id
|
location
|
string
|
Resource location
|
name
|
string
|
Resource name
|
properties.additionalCapabilities
|
AdditionalCapabilities
|
Enables or disables a capability on the dedicated host group. Minimum api-version: 2022-03-01.
|
properties.hosts
|
SubResourceReadOnly[]
|
A list of references to all dedicated hosts in the dedicated host group.
|
properties.instanceView
|
DedicatedHostGroupInstanceView
|
The dedicated host group instance view, which has the list of instance view of the dedicated hosts under the dedicated host group.
|
properties.platformFaultDomainCount
|
integer
|
Number of fault domains that the host group can span.
|
properties.supportAutomaticPlacement
|
boolean
|
Specifies whether virtual machines or virtual machine scale sets can be placed automatically on the dedicated host group. Automatic placement means resources are allocated on dedicated hosts, that are chosen by Azure, under the dedicated host group. The value is defaulted to 'false' when not provided. Minimum api-version: 2020-06-01.
|
tags
|
object
|
Resource tags
|
type
|
string
|
Resource type
|
zones
|
string[]
|
Availability Zone to use for this host group. Only single zone is supported. The zone can be assigned only during creation. If not provided, the group supports all zones in the region. If provided, enforces each host in the group to be in the same zone.
|
DedicatedHostGroupInstanceView
DedicatedHostGroupListResult
The List Dedicated Host Group with resource group response.
Name |
Type |
Description |
nextLink
|
string
|
The URI to fetch the next page of Dedicated Host Groups. Call ListNext() with this URI to fetch the next page of Dedicated Host Groups.
|
value
|
DedicatedHostGroup[]
|
The list of dedicated host groups
|
DedicatedHostInstanceViewWithName
The instance view of a dedicated host that includes the name of the dedicated host. It is used for the response to the instance view of a dedicated host group.
Name |
Type |
Description |
assetId
|
string
|
Specifies the unique id of the dedicated physical machine on which the dedicated host resides.
|
availableCapacity
|
DedicatedHostAvailableCapacity
|
Unutilized capacity of the dedicated host.
|
name
|
string
|
The name of the dedicated host.
|
statuses
|
InstanceViewStatus[]
|
The resource status information.
|
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.
|
StatusLevelTypes
The level code.
Name |
Type |
Description |
Error
|
string
|
|
Info
|
string
|
|
Warning
|
string
|
|
SubResourceReadOnly
Name |
Type |
Description |
id
|
string
|
Resource Id
|