Azure - get appserviceplan instance count Mar 26, 2018 • weznagwama Here’s a script to grab the instance count for your app service plans: $rg = read-host "Whats the rg?: " write-host "getting plans for rg $rg" try { $plans = Get-AzureRmAppServicePlan -ResourceGroupName $rg } catch { write-host "Unable to get plans! exiting" } $array = @() foreach ($plan in $plans) { write-host "Getting app service plan $($plan.ServerFarmWithRichSkuName)" $id = Get-AzureRmAppServicePlan -ResourceGroupName $rg -Name $plan.ServerFarmWithRichSkuName $res = Get-AzureRmResource -ResourceId $id.Id write-host "adding details to obj for output" $obj = New-Object System.Object $obj | add-member -MemberType NoteProperty -Name "name" -Value $plan.ServerFarmWithRichSkuName $obj | add-member -MemberType NoteProperty -Name "instances" -Value $res.sku.capacity $array += $obj } $array | ft