< Back

Get-AzureUtilEmptyResourceGroup

Sat Jan 11, 2020 12:17 pm

NAME Get-AzureUtilEmptyResourceGroup



SYNOPSIS

Get the resource groups that not contains any resources from the entire subscription.





SYNTAX

Get-AzureUtilEmptyResourceGroup [[-ExcludeResourceGroup] <String[]>] [[-ExcludeLocation] <String[]>]

[<CommonParameters>]





DESCRIPTION

Get the resource groups that not contains any resources from the entire subscription.





PARAMETERS

-ExcludeResourceGroup <String[]>

This cmdlet is ignore the resource groups that provided by this parameter. This parameter is optional.



Required? false

Position? 1

Default value

Accept pipeline input? false

Accept wildcard characters? false



-ExcludeLocation <String[]>

This cmdlet is ignore the resource groups that has location provided by this parameter. This parameter is

optional.



Required? false

Position? 2

Default value

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS

Microsoft.Azure.Commands.ResourceManager.Cmdlets.SdkModels.PSResourceGroup





-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Get-AzureUtilEmptyResourceGroup



---- Example Description ----

This example is get the all empty resource groups in current subscription.









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>Get-AzureUtilEmptyResourceGroup | Format-Table -Property 'ResourceGroupName','Location'



ResourceGroupName Location

----------------- --------

ProjectA-RG westus

ProjectB-RG eastus

Prod-RG japaneast

Test-RG japanwest



---- Example Description ----

This example is get the all empty resource groups in current subscription.









-------------------------- EXAMPLE 3 --------------------------



PS C:\\>Get-AzureUtilEmptyResourceGroup -ExcludeLocation 'japaneast','Japan West'



---- Example Description ----

In this example, it is to get the all empty resource groups in the current subscription except the resource

group's location is "japaneast" or "Japan West".









-------------------------- EXAMPLE 4 --------------------------



PS C:\\>Get-AzureUtilEmptyResourceGroup -ExcludeResourceGroup 'ProjectA-RG','ProjectB-RG' |

Remove-AzureRmResourceGroup -Force



---- Example Description ----

In this example, it is to remove the all empty resource groups in the current subscription except the

"ProjectA-RG" and "ProjectB-RG" resource groups. Those resource groups are not included to remove even if those

were empty.









-------------------------- EXAMPLE 5 --------------------------



PS C:\\>Get-AzureUtilEmptyResourceGroup -ExcludeResourceGroup 'Prod-RG' -ExcludeLocation 'Japan West'



---- Example Description ----

In this example, it is to get the all empty resource groups in the current subscription except the resource group

that is name is "Prod-RG" or location is "Japan West".











RELATED LINKS

PowerShell Gallery: https://www.powershellgallery.com/packages/AzureUtil/

GitHub: https://github.com/tksh164/AzureUtil-PowerShellModule

Get-AzureUtilNonAttachedManagedDisk

Get-AzureUtilNonAttachedUnmanagedDisk