Reputation: 391
Does anyone know an easy way to find resources based on multiple tags? Eg find resources based on tag1 = 'value1' and tag2= 'value2'
The Find-AzureRmResource -Tag seems to ignore when multiple tags are specified in the hashtable, which means the following returns sesources with tag1 = 'value1' or tag2= 'value2, and sometimes just the one.
Find-AzureRmResource -Tag @{tag1 = 'value1';tag2 = 'value2}
Wondering if there is an easy query/copmmand for an and connector, or similar routine.
Thanks
Upvotes: 2
Views: 1410
Reputation: 391
I worked around it by using a query:
Get-AzureRmVM | where {$_.Tags['tag1'] -eq "value1" -and $_.Tags['tag2'] -eq "value2"}
I was only after VMs; I guess there is likely something similar for other resources.
Upvotes: 1