Mike Goatly
Mike Goatly

Reputation: 7538

Programmatically determining the child resources of an Azure resource

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/default
/subscriptions/.../Microsoft.Storage/storageAccounts/mystorageaccount/fileServices/default
/subscriptions/.../Microsoft.Storage/storageAccounts/mystorageaccount/queueServices/default
/subscriptions/.../Microsoft.Storage/storageAccounts/mystorageaccount/tableServices/default

I'm particularly interested in child resources that have metrics associated to them. I've dug around a bit in the preview versions of the Microsoft.Azure.Management.Monitor and Microsoft.Azure.Management.ResourceManager packages, but can't spot anything obvious.

Upvotes: 2

Views: 476

Answers (1)

Sajeetharan
Sajeetharan

Reputation: 222582

Yes you can use the REST API to list down the resources in a resource group

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

There is no specific API available to list the child resources under specific service as of now. However, there are specific API for each service avaialble for ex. AppService

Upvotes: 1

Related Questions