2

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.

Mike Goatly
  • 7,380
  • 2
  • 32
  • 33

1 Answers1

1

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

Sajeetharan
  • 216,225
  • 63
  • 350
  • 396
  • Ok thanks - I was aware of getting resources within a resource group. It's a shame that there's no API for child resources yet. I might be able to work around it though by correlating with the providers list for the resource type. – Mike Goatly Nov 01 '19 at 10:53
  • why do you think it is needed when there are docs? upvote if this answer helped – Sajeetharan Nov 01 '19 at 10:57
  • I'm building a monitoring system for Azure resources and automatic discovery of resource and metrics is a requirement – Mike Goatly Nov 01 '19 at 11:10
  • And yes, I know monitoring is built into Azure - this is quite a specialized case :) – Mike Goatly Nov 01 '19 at 11:10