0

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?

1 Answer 1

2

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 
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.