Skip to content

Azure Function Flex Plan Migration – Steps, Benefits, and Practical Tips

azure flex consumption function migration steps

Why the Azure Functions Flex Consumption Plan Matters

In November 2024, Microsoft announced the general availability of the Azure Functions Flex Consumption Plan. This plan extends the traditional pay-per-second billing model while adding more performance and flexibility. It scales from zero to 1,000 instances, supports concurrency-based scaling for both HTTP and non-HTTP triggers, and eliminates cold starts using its Always Ready feature.

The Azure Functions Flex Consumption Plan is designed to address enterprise needs without incurring fixed monthly fees. It offers the same cost-effective model found in traditional consumption plans but adds increased memory, concurrency, and virtual network (VNET) integration.

In this blog post, you will learn how to migrate from the existing Consumption plan to the Azure Functions Flex Consumption Plan, what to watch out for, and a few practical tips along the way.

Benefits of the Flex Consumption Plan

If you are considering the Flex Consumption Plan on Azure, a helpful overview video is available from Microsoft Ignite (starting around 9:33 to 15:10). It highlights key advantages such as concurrency-based scaling and enterprise-ready features.

Some of the main benefits include:

  • VNET integration: Enhances security while still using a usage-based model without fixed monthly fees.
  • Improved scalability: Concurrency-based scaling dynamically allocates more resources as demand grows.
  • Predictable hosting: Offers the convenience of serverless alongside better performance.
  • Fully managed: No manual intervention is required for scaling.

Microsoft’s Stress Test Example mentions handling nearly three million requests in three minutes, with 90th-percentile execution times under 100ms. This performance is incredible given the pay-as-you-go pricing.

Linux-Only Hosting

Unlike the standard Consumption plan, the Flex Consumption Plan is available only in Linux-based environments. In App Service, Linux apps run inside containers where you have root access to the container but not to the host operating system.

Historically, some teams worried about slower performance on Linux. However, major improvements in 2022—such as switching from Nginx to Kestrel and YARP—have significantly boosted speed.

One caveat is potential storage latency, This may affect apps with heavy file I/O:

“When deployed to built-in images, your code and content are allocated a storage volume for web content, backed by Azure Storage. The disk latency of this volume is higher and more variable than the latency of the container filesystem.”

Also note that file path conventions differ on Linux. Always use System.IO.Path.Combine to avoid issues with forward and backward slashes in paths, examples:

C#
// Won't work on linux hosting plans
System.File.ReadAllText(“lib/myfile.txt”);
System.File.ReadAllText(Path.Combine(“lib/myfile.txt”));

// Use Path.Combine
System.File.ReadAllText(Path.Combine(“lib”,”myfile.txt”));

Understanding Azure Functions Flex Consumption Plan Pricing

Comparing Azure Functions Flex Consumption Plan pricing to the standard Consumption plan reveals a few differences:

  • Free execution grants are generally higher on the traditional Consumption plan.
  • On-demand execution time (GB-s) rates are somewhat higher under the azure flex consumption plan pricing model, but you receive more CPU/Memory (2 GB memory by default vs. 1.5 GB on Consumption).

Estimating Your Costs

If you have an existing Consumption plan, you can estimate costs by examining two main metrics:

  1. Function execution time (GB-s)
  2. Total executions

From the Azure portal, find your “function execution count” and “function execution units” under Metrics.

azure functions consumption price metrics total execution count execution units

Cost calculation for (On-demand) Execution time:

  1. Execution Units are given in MB-milliseconds. To convert to GB-seconds, divide by 1,024,000.
    45.58 MB-ms / 1,024,000 = 0.00004451171 GB-s
  2. Subtract any free grant to get your final cost.
  3. Then multiply by your region’s GB-s rate.

Cost calculation for Total executions:

  1. Likewise, subtract your free execution count
  2. Multiply the remainder by the per-execution cost in your region.

Concurrency-Driven Scaling and Load Testing Integration

In the Azure Functions Flex Consumption Plan, concurrency is deterministic for HTTP triggers. All HTTP-triggered functions in a single Flex Consumption plan share the same pool of instances, with new instances allocated based on a configurable concurrency level.

The exciting change is native load testing integration for the Flex plan. Azure Load Testing can help you optimise performance and cost by experimenting with different instance sizes and concurrency settings. More details here

azure functions flex plan concurrency

Extended Function Timeout

A significant advantage of the azure functions flex consumption plan is the lack of a fixed maximum timeout. On the standard Consumption plan, functions time out after 10 minutes, but under Flex Consumption there is effectively no maximum. Microsoft does apply a 60-minute grace period during scale-in to prevent indefinite executions, but this remains a substantial improvement.

You can set the extended timeout in your host.json:

C#
{
  "functionTimeout": "01:00:00"
}

While a Premium plan also removes the 10-minute limit, it typically incurs higher costs. The azure functions flex consumption plan pricing often proves more economical for workloads with intermittent usage.

Migrating Your Function App to the Flex Consumption Plan

Under your Function App’s App Service plan settings, you might notice an option labelled “Change App Service plan.”

azure function change app service plan portal

However, direct migration between a standard Consumption plan and the Flex plan is currently unsupported. Both plans must:

  • Reside in the same region
  • Belong to the same resource group
  • Use the same operating system

Since Azure Functions Flex Consumption only runs on Linux, direct migrations from Windows-based Consumption plans are (not yet) available. Additionally, you cannot host multiple function apps under multiple Flex plans. If you try, you may see an error similar to:

“There is already a site linked to the specified Flex Consumption Plan serverfarm. There can only be one site per Flex Consumption serverfarm.”

As a result, you may need to provision a new function app in the Flex Consumption plan, then redeploy your code.

Potential Limitations and Gaps

When switching from a Windows-based Consumption plan to the Flex Consumption Plan on Linux, you may encounter a few missing features:

  • Performance with Storage: Some workloads see higher I/O latency on Azure Storage-backed volumes.
  • Diagnostics Settings: Not visible or fully supported in the portal for Flex on Linux.
  • Metrics: Some monitoring or metrics might be incomplete in the early stages of Flex plan usage.

Conclusion

In my own experience, the Azure Functions Flex Consumption Plan has been a real game-changer. It offers powerful features—like VNET integration and extended timeouts—without abandoning the serverless, pay-as-you-go model. For me, the best part is balancing cost and scalability for workloads that don’t justify a full Premium or Dedicated plan.

Switching to Linux hosting may feel like a shift, but it’s more straightforward than it used to be, thanks to Microsoft’s improvements and the familiar tooling in the Azure portal. I hope this post has given you some insights into the potential of the Flex Consumption Plan on Azure. If you’re looking for enterprise-grade performance without fixed monthly fees, I believe this plan is well worth exploring.

Happy Flex hosting!