Search code examples
powershellazureazure-web-app-serviceazure-resource-manageroctopus-deploy

List instances of Azure App Service with Powershell RM


My aim is to find all the instance Ids of a particular App Service in Azure so I can write a warm-up routine and test it against all running instances (ARRAfinity).

I can do the following with ASM Powershell but I need it in ARM (RM) as Octopus is configured for it.

(Get-AzureWebsite -Name "site-name" -Slot "Production").Instances

I have found the documentation around RM sparing, and the following hasn't led me to anything helpful:

Get-AzureRmWebApp -Name "site-name"

Any help would be really helpful.


Solution

  • Try something like this:

    Get-AzureRmResource -ResourceGroupName $ResourceGroupName -ResourceType Microsoft.Web/sites/instances -Name $WebAppName -ApiVersion 2016-03-01
    

    See also here for a helper function that also works on slots.