Tuesday, December 15, 2020

Azure Functions: Change PlanType from Consumption (Serverless) to Premium

This is a quick post on how we can change the Plan Type of an Azure Function App from Consumption (Serverless) to a Premium Plan. If you have created an Azure Function App initially selecting Consumption (Serverless) as the plan type and then later if you want to change it to a Premium Plan, Azure Portal has no direct way to do it.

Here you have 2 options,

  1. Create a new Azure Function App with a Premium plan and redeploy code
  2. Create a new Azure Function Premium Plan and change the existing Function App to use the new plan through Azure CLI
The first option can be a pain, you basically need to setup everything and deploy the code. The second option is pretty easy.

First, we need to create a new Azure Function Premium Plan.
az functionapp plan create `
--resource-group <resource group> `
--name <new plan name> `
--location <location> `
--sku <EP1 or EP2 or EP3> `
--is-linux true
--is-linux is only if you want it to be Linux, well it's self-explanatory.

Next, we need to associate the existing Function App with the new plan.
az functionapp update `
--resource-group <resource group of the existing function app> `
--name <existing function app name> `
--plan <new plan name>
That's easy. Hope this helps.

Happy Coding.

Regards,
Jaliya

Update: 2024-09-21


Tried this on Linux, got an error: 
This feature currently supports windows to windows plan migrations. For other migrations, please redeploy.
You can use the following to update a Linux Function App.
az resource update `
    --resource-type "Microsoft.Web/sites" `
    --resource-group <resource group> `
    --name <existing function app name>`
    --set properties.serverFarmId=<new plan resource id>

No comments:

Post a Comment