Powershell  to delete all resources from Azure resource group with specific tag

Problem ->  If we want to cleanup all resource for cost saving and if the all resources have some tag set then we can remove all resources automatically using powershell

Solution 1 – delete all resources with specific tag across subscription

$tagname = “resourcetype”
$TagValue =”Service Fabric”
Find-AzureRmResource -TagName $tagname -TagValue $TagValue | Remove-AzureRmResource -force

Solution 2 – delete all resources with specific tag from specific resource group

$rg= “TestRG”
$tagname = “resourcetype”
$TagValue =”Service Fabric”
Find-AzureRmResource -TagName $tagname -TagValue $TagValue |where{$_.resourcegroupname -eq $rg}| Remove-AzureRmResource -force

note – change below values before use

$rg= “TestRG”
$tagname = “resourcetype”
$TagValue =”Service Fabric”


(Visited 3 times, 1 visits today)
, , , , , ,

By Arun Sabale

Arun is a Solution Architect on enterprise client management with more than 14 years of experience in IT. Arun Sabale is Blogger and tech enthusiast. His main focus is on Azure cloud infra, Cloud automation with powershell, python, ARM terraform and all cloud infra services like compute, storage, network, automation, function api etc... LinkedIN - https://www.linkedin.com/in/arun-sabale/

Comments are closed.