I'm using a 'Basic' plan. I want to create a script which can switch 'always-on' to false, then change the service plan to the free tier. When I need the function again I can reverse the settings. Why am I doing this? So I can ensure the App service plan keeps the same outbound IP addresses. I don't want to be paying for a Basic plan all the time so a simple script to do this is required.
I am using the latest 'AZ' modules.
$site = Get-AzWebApp -ResourceGroupName $ResourceGroupName -Name $SiteName
$site.SiteConfig.AlwaysOn = $false
Set-AzWebApp -ResourceGroupName $ResourceGroupName -Name $SiteName ???
Thanks
Setting App Service Plan
Set-AzAppServicePlan -ResourceGroupName "myrgname" -Name "my app service plan name" -Tier Basic -WorkerSize Small
For Free, you can change the Tier name to Free
Setting Always On
Connect-AzAccount
$webApp = Get-AzResource -ResourceType 'microsoft.web/sites' -ResourceGroupName 'myrgname' -ResourceName 'my function app name'
$webApp | Set-AzResource -PropertyObject @{"siteConfig" = @{"AlwaysOn" = $false}}
Here are two other similar SO posts.. difference is they don't tackle App Service Plan tier changes or make use of the latest Az modules Post1 and Post2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With