''Find-AzureRmResource' is not recognized as the name of a cmdlet

I am trying to nuke an azure subscription and I found this

https://www.frankysnotes.com/2016/12/need-to-nuke-azure-subscription.html

As I run the final part I got an error of

"Find-AzureRmResource : The term 'Find-AzureRmResource' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again."

Can someone help me how to fix this so I can nuke my Azure subscription?



Solution 1:[1]

Instead of using AzureRM module, use Az module as the former is now deprecated. To learn more about it, please see https://docs.microsoft.com/en-us/powershell/azure/migrate-from-azurerm-to-az?view=azps-7.5.0.

Simplest code to delete all resources from a subscription would be to list resource groups in that subscription and then delete them.

Your code would be something like:

Get-AzResourceGroup | Remove-AzResourceGroup

Solution 2:[2]

Please use Get-AzureRmResource instead of Find-AzureRmResource.
Find-AzureRmResource is depreacted.

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

How to safely replace Find-AzureRmResource -ResourceType calls in Azure PowerShell 6.x+

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Gaurav Mantri
Solution 2 Markus Meyer