Elastic Premium plan? It's got potential.

How to change Azure Functions from Consumption to Premium Elastic plan?

This post was most recently updated on June 23rd, 2022.

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 the Consumption plan and want to use the Premium Elastic plan instead.

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! You’ll hit a roadblock if you try to upgrade/move to an App Service Plan from Consumption using the Azure Portal. Let’s take a closer look…

Problem

What do I mean? Well, if you have selected the 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

So, what is the workaround? Luckily – it’s pretty simple! Let’s get to it.

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.

    If you’re unsure about the SKU you should be using, see the options (somewhat up-to-date, thanks to Microsoft) here.

  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 copy-paste 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.

Did it help you? Have another issue with your Azure Functions? Let me know in the comments -section below!

References

mm
4.7 16 votes
Article Rating
Subscribe
Notify of
guest

10 Comments
most voted
newest oldest
Inline Feedbacks
View all comments