Created
July 24, 2022 10:33
-
-
Save ilmax/efaee63ccba80469ee51fd0a15565e73 to your computer and use it in GitHub Desktop.
Azure automation account runbook to scale up & down an App Service Plan
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$errorActionPreference = "Stop" | |
Write-Output "--- Connecting to Azure using MSI..." | |
Connect-AzAccount -Identity | |
Write-Output "--- Reading variables...." | |
$rg = Get-AutomationVariable -Name 'rg-name' | |
$servicePlan = Get-AutomationVariable -Name 'service-plan-name' | |
$sk = Get-AutomationVariable -Name 'scale-down-sku' | |
Write-Output "--- Processing '$servicePlan' App Service Plan..." | |
$currentAppServicePlan = Get-AzAppServicePlan -ResourceGroupName $rg -Name $servicePlan | |
Write-Output "--- Converting '$servicePlan' to '$sk'..." | |
Set-AzAppServicePlan -ResourceGroupName $rg -Name $servicePlan -Tier $sk | |
Write-Output "--- Done!'" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment