This post was most recently updated on June 11th, 2021.2 min read.
Sometimes, you need to change the hosting model (or tier) for your resources on Azure. Maybe you’ve outgrown whatever you’ve originally selected, maybe you’ve got too much cash on your hands, or maybe you’re like me, and you get absolutely and completely fed up with the cold starts for your Azure Function apps on Consumption plan.
For these situations, you have the possibility of changing the hosting tier – the plan – you’re on. Although, this has been implemented in a disturbingly non-intuitive way! Let’s take a closer look…
What do I mean? Well, if you have selected Consumption plan originally, and you’ll then try to change the plan, you’ll run into this annoying sight:
Surprise, surprise: There is no UI for this. And not just that – the UI is just downright lying – you can definitely change the plan :)
In short: no worries! As always, there’s a workaround.
As a prerequisite, you’ll need to have Azure CLI installed. You can get it from here:
Then, on with the actual installation steps!
Time needed: 25 minutes.
How to update the plan/tier your Azure Function app is on?
- Log in
Well, we’ll start by authenticating the CLI using the account you use for managing Azure resources.
- Select the subscription
This subscription needs to be the one your Azure Function app is currently located in. Azure CLI requires this to be “locked” for running the commands.
az account set --subscription "[your-subscription-id]"
- Create a new app service plan
The command below creates a new app service plan for a function app. You set the name (and you’ll need it later), select the resource group, set the plan SKU (in my example Elastic Premium 1), and you can set the scaling limits by setting the initial number of instances (min-instances) and the peak (max-burst) during high load.
az functionapp plan create --name "[name-your-elasticpremiumplan]" --resource-group "[name-of-your-existing-resourcegroup]" --sku EP1 --min-instances 1 --max-burst 2
Running this command might sometimes take a looong while. Don’t be alarmed if it takes 10-15 minutes.
- Move your existing Function App to the newly created plan
The command below moves your Function App to the newly created plan. Be very mindful of the names you’re entering here – you need to copypaste the plan name from before!
az functionapp update --plan "[the-elasticpremiumplan-name-from-above]" -n "[azure-function-to-move]" --resource-group "[name-of-your-existing-resourcegroup]"
This can be another slow command to execute.
And boom! You should be good.
- CLI docs for the functionapp commands: