Simple script to turn off AlwaysOn to save memory for dev/test apps. Not recommended for production apps since this will cause your app to sleep and that first request will take a while as the app wakes up. We saved enough memory to consolidate our test apps into one app service plan. For some reason powershell wasn’t turning it off when I tried with Set-AzResource, but the CLI worked fine.
[code language=”powershell”]
az login
az account set –subscription ‘yer sub name’
$rg = ‘rg name’
$apps = (Get-AzWebApp -ResourceGroupName $rg).Name
foreach ($app in $apps) {
az webapp config set –name $app –resource-group $rg –always-on false
}
[/code]
2 Trackbacks