April 11, 2018

Azure - Find empty Resource Groups

How to identify empty Resource Groups in Microsoft Azure using PowerShell?
Login-AzureRmAccount
$AllRGs = (Get-AzureRmResourceGroup).ResourceGroupName
$RGsWithResources = (Get-AzureRMResource | Group-Object ResourceGroupName).Name
$AllRGs | Where-Object {$_ -notin $RGsWithResources}

No comments:

Post a Comment