> ## Content Index
> Fetch the complete content index at: https://codeisahighway.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# How to safely replace Find-AzureRmResource -ResourceType calls in Azure PowerShell 6.x+
- URL: https://codeisahighway.com/how-to-safely-replace-find-azurermresource-resourcetype-calls-in-azure-powershell-6-x/
- Published: 2018-06-20T16:49:27.000Z
- Updated: 2026-07-31T19:44:27.000Z
- Author: Stephane Lapointe
- Tags: Microsoft Azure, Azure Resource Manager, PowerShell, HowTo, Breaking Change, #Import 2023-07-11 16:44, #Import 2026-09-04 10:31, #Import 2026-09-04 13:56

UPDATE: 2018-06-28 - Added resourcegroup ODataFilter example.

Starting with version 6.0 of Azure PowerShell, `Find-AzureRmResource` have been removed and `Get-AzureRmResource` is supposed to be the workaround.

My first reflex was to just convert `Find-AzureRmResource -ResourceType` to `Get-AzureRmResource -ResourceType` but I was unlucky and hit a regression and an error saying I could not only provide the `ResourceType` parameter.

On my machine, with version 5.2.0 of *AzureRM.Resources* module, I get the following error if trying the following command:

```powershell
Get-AzureRmResource -ResourceType Microsoft.Storage/storageAccounts
Get-AzureRmResource : Parameter set cannot be resolved using the specified named parameters.
At line:1 char:1
+ Get-AzureRmResource -ResourceType Microsoft.Storage/storageAccounts
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Get-AzureRmResource], ParameterBindingException
    + FullyQualifiedErrorId : AmbiguousParameterSet,Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation
   .GetAzureResourceCmdlet

```

I found a safer way to replace a search by resource type, we can use the OData parameter like so:

```powershell
Get-AzureRmResource -ODataQuery "`$filter=resourcetype eq 'Microsoft.Storage/storageAccounts'"

```

You can be more restrictive and filter by resource type & resource group :

```powershell
Get-AzureRmResource -ODataQuery "`$filter=resourcetype eq 'Microsoft.Storage/storageAccounts' and resourcegroup eq 'myrg'"

```

This worked for me in AzureRM 5.x and AzureRM 6.x

Happy script rewrite!

## Resources

- [Azure PowerShell v6.0.0-May2018](https://github.com/Azure/azure-powershell/releases/tag/v6.0.0-May2018?ref=codeisahighway.com)