azureazure-resource-groupazure-devtest-labs

How to get all Azure Resources without tags in a Azure Resource Group


In my Azure dev/test lab (DTL), there are many resources which were not tagged. How can I get a list of all untagged resources under DTL/resource group?


Solution

  • This link has the solution for this question. It beautifully explains assigning and querying tags using powershell.

    $resourceGroupName = 'InternalReportingRGDev'

    $azureRGInfo = Get-AzureRmResourceGroup -Name $resourceGroupName foreach ($item in $azureRGInfo)

    {

    Find-AzureRmResource -ResourceGroupNameEquals $item.ResourceGroupName | ForEach-Object {Set-AzureRmResource -ResourceId $PSItem.ResourceId -Tag $item.Tags -Force }

    }