Using Get-AzureRmResource to find Azure resources using Tags

This post will look at how we can find resources in Azure using the latest PowerShell modules and replace the Find-AzureRmResource cmdlet which will no longer work.   Note that the commands are not similar and official documentation is limited or not very clear.

The term ‘Find-AzureRmResource’ is not recognized as the name of a cmdlet

The above error will be returned if you try and use the old cmdlet after you have upgraded to V6.0+ of the Azure PowerShell modules.  Remember to also update your Azure Automation modules if you are using this.

So how do we find resources by their tag name AND value using Get-AzureRmResource ?

Well the short answer is first get the resources with the tag NAME you are interested in, and then check the value of that specific tag.

# Brings back all objects with specified tag name, then checks value of specific tag
Get-AzureRmResource -TagName "Autoshutdown" -ResourceType Microsoft.Compute/virtualMachines `
    | where { $_.Tags[‘Autoshutdown’] -ieq "No" } | Select Name, tags

Video Demonstration with Examples



You receive the error The term ‘Find-AzureRmResource’ is not recognized as the name of a cmdlet when you run your script manually or as part of an Azure Automation job.

This means the Azure PowerShell modules have been updated to the latest V6 or higher.  You need to change your code to use Get-AzureRmResource to find your objects.


About Mitesh Chauhan
Mitesh Chauhan, Azure Cloud Solutions Architect. This is my blog where I share articles and thoughts on IT Infrastructure and architecture. The topics I am most passionate about are Implementation and architecture of rock solid Cloud Infrastructure based around SQL Server and Windows Server mainly using Microsoft Azure. MCTS - Azure Architecture MCTS - Azure Implementation MCSE Server Infrastructure (Windows Server 2012) , MCITP SQL Server 2008, Togaf Certified, Prince 2 Practitioner.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: