Azure – turn off AlwaysOn to save memory

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.

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

Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

2 Trackbacks