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

Time:05-26

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?

CodePudding user response:

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

CodePudding user response:

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

  • Related