简体   繁体   中英

List All Deployment Slots in Azure

I am trying to find a PowerShell, Azure CLI or portal blade that lists all the deployments slots in use (with or without production included).

It has come to my attention that there were some apps deployed as slots that were never shutdown/deleted and they're just hanging out taking up resources (or potentially taking up resources).

I did find a CLI option that allows me to go through each resource group and list them, which also lists the slots. But if onehas a lot of resources, this is not an easy way to go about it.

 azure list webappp { resource group name }

UPDATE - APR 26 2018

Here's one place in the portal that will list slots next to apps:

App Service Plans > Plan > Apps

I don't believe there's a single command for this. But in PowerShell, assuming you're logged in and have selected the subscription you're interested in, you could simply loop through and look for all instances of the resource provider 'Microsoft.Web/sites/slots', like so:

$resources = Get-AzureRmResource
foreach($resource in $resources)
{
    if ($resource.ResourceType -eq 'Microsoft.Web/sites/slots')
    {
        echo $resource.Name
    }
}

You'd need a similar enclosing loop if want to do this for more than one subscription.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM