Elastic Premium plan? It's got potential.

How to upgrade your Azure Function app plan when you originally selected “Consumption”?

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…

Problem

Table of Contents

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:

Azure Function app on a Consumption plan has both Scale up and Scale out disabled, and this error is shown for both of them.
Azure Function app on a Consumption plan has both Scale up and Scale out disabled, and this error is shown for both of them.

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.

Solution

As a prerequisite, you’ll need to have Azure CLI installed. You can get it from here:

https://docs.microsoft.com/en-us/cli/azure/install-azure-cli

Then, on with the actual installation steps!

Time needed: 25 minutes.

How to update the plan/tier your Azure Function app is on?

  1. Log in

    Well, we’ll start by authenticating the CLI using the account you use for managing Azure resources.

    az login

  2. 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]"

  3. 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.

  4. 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.

References

mm
5 12 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments