I wonder if there is a way to get all resources of a particular type under a resource group?
Asked
Active
Viewed 161 times
2 Answers
1
Yes, the easiest way to do it is using powershell , try the command below :
Get-AzResource -ResourceGroupName <resource group name>| where {$_.ResourceType -eq <resource type>} |select Name , ResourceId
Hope it helps .

Stanley Gong
- 11,522
- 1
- 8
- 16
-
Thanks for the answer, sorry I did not make it clear I want to do it through Azure arm template. I tagged the question as a arm-template question, but forgot to make it more clear in the description. Edited the question. Thanks! – Yituo Sep 30 '19 at 02:49
1
you can use resourceId()
function for that for a single resource:
"[resourceId('otherResourceGroup', 'Microsoft.Storage/storageAccounts', 'examplestorage')]"
this is not possible for ALL the resources in the resource group unless you know their names beforehand and use resourceId function for each one individually
or you could use external scripts, like the other answer suggests

4c74356b41
- 69,186
- 6
- 100
- 141