Reputation: 2808
I have tagged my azure resource groups based on environments.
Now I'am trying to do some automation on the test environments and I want to retrieve all resource groups tagged with Env=test.
I found this line here (https://azure.microsoft.com/nb-no/documentation/articles/resource-group-using-tags/)
$testRg= Find-AzureRmResourceGroup -Tag @{ Name="Env"; Value="Test" } | %{ $_.Name }
The problem is that this doesn't return anything.
Then i tried to tag a single resource with the same tag and that worked with this line:
$testR= Find-AzureRmResource -TagName Env -TagValue Test| %{ $_.ResourceName }
Anyone experienced this or know what I'am doing wrong?
Upvotes: 0
Views: 336
Reputation: 2808
After august 2016. Azure powershell had breaking changes apparently. https://azure.microsoft.com/en-us/documentation/articles/resource-group-using-tags/
The correct way to retrieve resource group based on tags after Azure powershell verion 3.0 is:
(Find-AzureRmResourceGroup -Tag @{ Env="Test" }).Name
Upvotes: 2