Azure | How to Migrate from Consumption Plan to App Service Plan


Change Function app hosting plan


How to Migrate from Consumption Plan to App Service Plan


How to Migrate from Consumption Plan to Premium Plan

Issue:

  • I want to change my consumption plan to app service plan.
  • I want to change my app service plan to consumption plan.
  • Is there any way to change Azure function hosting plans?

Solution:

Azure Functions is a popular serverless computing platform that allows developers to write and run event-driven functions in the cloud. Azure Functions hosting plan migration refers to the process of moving your Azure Functions from one hosting plan to another. In this blog, we will explore the reasons for hosting plan migration, the different types of hosting plans available, and the steps involved in migrating your Azure Functions to a new hosting plan.

Reasons for Hosting Plan Migration,

There are several reasons why you may want to migrate your Azure Functions to a new hosting plan. Some common reasons include:

  • Performance: If you're experiencing performance issues with your current hosting plan, you may want to migrate to a higher-performance plan to improve the speed and reliability of your functions.
  • Cost: If you're looking to save costs on your Azure Functions, you may want to migrate to a lower-cost hosting plan.
  • Scaling: If you're expecting increased traffic or usage for your Azure Functions, you may want to migrate to a hosting plan that supports higher scalability.

There are 3 types of hosting plan available from function app,

  • Consumption plan
  • Dedicated App service plan
  • Premium plan

Each plan has its own advantage and limitation. You should choose it carefully. 

You may see lot of articles and blog which suggest you can change function app hosting plan from consumption to dedicated App Service plan and you will be able to achieve that also, but according to Microsoft recommendation, You should never do thisYour function app will be messed up and you will see a lot of issues. 

This has been mentioned on Microsoft Official documentation. 

You can switch between Consumption and Premium plans by changing the plan property of the function app resource.

But You can't change consumption plan to Dedicated App Service plan or vice versa. 

Ref: https://docs.microsoft.com/en-us/azure/azure-functions/functions-scale  

Now we know we can migrate consumption to App service plan hence we should focus on, how to achieve it.

Steps to change function app from consumption to premium,

  • Create the premium plan.
  • Then update the plan property of the function app so it no longer points to the consumption plan but the premium one.
  • This feature is not available in UI right now
  • You can use CLI command for this,

az functionapp update --name MyFunctionApp --plan <plan name or plan-resource-id>”

 

CLI Ref: https://docs.microsoft.com/en-us/cli/azure/functionapp?view=azure-cli-latest#az-functionapp-update

The premium plan is supported in some regions only. you can get the list of regions in the below URL if you face any region issue.

https://docs.microsoft.com/en-us/azure/azure-functions/functions-premium-plan#regions

 I observed some limitation as of now e.g. It only worked when,

  • Both plans are in the same region.
  • Both plans are in the same resource group.

More info : https://github.com/Azure/Azure-Functions/issues/1194 

For the dedicated app service plan, the only option is: You should create a new function app in different hosting plan and update/deploy your code.  

Please don’t try to change function app hosting plan from consumption to Dedicated App Service plan or vice versa. This may be possible in future but not now. 

Hope this helps. Please let me know in comment section  if you have any query.
Happy to help you :)

Migrating your Azure Functions to a new hosting plan can help improve the performance, scalability, and cost-effectiveness of your serverless applications. By understanding the reasons for hosting plan migration, the different types of hosting plans available, and the steps involved in migrating your Azure Functions, you can make an informed decision about the best hosting plan for your specific needs. Whether you choose the Consumption Plan or the App Service Plan, Azure Functions provides a flexible and powerful platform for building and deploying event-driven serverless functions.


Other useful references,

Issue: Azure function is throwing one of the following exceptions
·       Unable to retrieve Functions Keys
·       We are not able to retrieve the keys for function
·       The function runtime is unable to start.
·       Function host is not running.
·       Internal Server error.
·       Service Unavailable.


Issue: Azure Functions: The Consumption pricing tier is not allowed in this resource group



Issue: Disable Azure functions






2 comments:

  1. Thank you for sharing this information. It cleared all my confusions i had regarding this topic. U demonstrated it in a simple and understanding way. thank you.

    ReplyDelete