how to list child resource via the SDK

Collection Team 0 Reputation points
2025-05-05T22:20:40.2533333+00:00

Given an Azure resource, e.g. a storage account:

/subscriptions/.../resourceGroups/myresources/providers/Microsoft.Storage/storageAccounts/mystorageaccount

Is there any way to programmatically determine that there are child resources under it, e.g. the storage account resource would return:

/subscriptions/.../Microsoft.Storage/storageAccounts/mystorageaccount/blobServices/

for fetching the metrics of these child resources?


Also, for the above 4 we can manually create the URI by adding default in the end but for other child resources like

objectReplicationPolicies

storageTasks

there is no way to identify automatically and fetch the metrics

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
3,590 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Vinod Pittala 1,830 Reputation points Microsoft External Staff Moderator
    2025-05-05T23:46:56.6033333+00:00

    Hello Collection Team,

    To list all the children resource and its current health status for a parent resource. Use the below REST API to get the next page of children current health.

    GET https://management.azure.com/{resourceUri}/providers/Microsoft.ResourceHealth/childResources?api-version=2025-04-01
    

    Refer to the below link: https://learn.microsoft.com/en-us/rest/api/resourcehealth/child-resources/list?view=rest-resourcehealth-2025-04-01&tabs=HTTP#code-try-0

    As you mentioned, if you cannot find the URI for some child resources like objectReplicationPolicies or storageTasks, you can list them by Resource Group as shown below.

    Since there is no other straightforward solution to list the child resources, you can get all the resources for a resource group. This will include the child resources under its RG.

    GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/resources?api-version=2021-04-01
    
    

    Follow the below link: https://learn.microsoft.com/en-us/rest/api/resources/resources/list-by-resource-group?view=rest-resources-2021-04-01#code-try-0

    If the provided solution works for your query, please do not forget to click Upvote Button. this can be beneficial to other community members.it would be greatly appreciated and helpful to others

    Thanks

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.