Created
January 30, 2023 09:37
-
-
Save isjwuk/63a88bee4fa59d35e359dd9e4ba048d1 to your computer and use it in GitHub Desktop.
Find Azure App Service Plans with no App Services associated with them.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.SYNOPSIS | |
Find empty Azure App Service Plans | |
.DESCRIPTION | |
Find Azure App Service Plans in the current Azure Context with no App Services associated with them. | |
These empty App Service Plans will potentially be incurring unneccessary charges. | |
.EXAMPLE | |
#Return a list of Empty App Service Plans in the current Azure Context | |
Get-AzEmptyAppServicePlans | |
.EXAMPLE | |
#Remove any empty App Service Plans in the current Azure Context | |
Get-AzEmptyAppServicePlans | Remove-AzAppServicePlan | |
#Append with -Force to bypass confirmation | |
.EXAMPLE | |
#List the Name and Resource Group Name of any empty App Service Plans in the current Azure Context | |
Get-AzEmptyAppServicePlans | Select-Object Name, ResourceGroup | |
#> | |
function Get-AzEmptyAppServicePlans{ | |
Return( Get-AzAppServicePlan | Where-Object {$_.NumberOfSites -eq 0}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment