Skip to content

Commit b26f041

Browse files
Merge pull request #301534 from ggailey777/flex-migration
[Functions][Flex] Migration from Consumption plan guide
2 parents 20cc60a + 0611d73 commit b26f041

11 files changed

+1792
-97
lines changed

articles/azure-functions/TOC.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -760,6 +760,8 @@
760760
displayName: upgrade, migrate, language stack
761761
- name: Migrate Node.js to model v4.x
762762
href: functions-node-upgrade-v4.md
763+
- name: Migrate Consumption plan apps to Flex Consumption
764+
href: migration/migrate-plan-consumption-to-flex.md
763765
- name: Migrate .NET apps to the isolated model
764766
href: migrate-dotnet-to-isolated-model.md
765767
- name: Move resources

articles/azure-functions/flex-consumption-how-to.md

Lines changed: 133 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ To support your function code, you need to create three resources:
133133
This command creates a function app running in the Flex Consumption plan.
134134
135135
Because you created the app without specifying [always ready instances](#set-always-ready-instance-counts), your app only incurs costs when actively executing functions. The command also creates an associated Azure Application Insights instance in the same resource group, with which you can monitor your function app and view logs. For more information, see [Monitor Azure Functions](functions-monitoring.md).
136-
```
136+
137137
138138
### [Azure portal](#tab/azure-portal)
139139
@@ -183,7 +183,7 @@ You can use the Azure CLI to upload a deployment package file to the deployment
183183
This package file must contain all of the build output files and referenced libraries required for your project to run.
184184
::: zone-end
185185
::: zone pivot="programming-language-javascript,programming-language-typescript"
186-
For projects with a large amount of libraries, you should package the root of your project file and request a [remote build].
186+
For projects with a large number of libraries, you should package the root of your project file and request a [remote build].
187187
::: zone-end
188188
::: zone pivot="programming-language-python"
189189
For Python projects, you should package the root of your project file and always request a [remote build]. Using a remote build prevents potential issues that can occur when you build a project on Windows to be deployed on Linux.
@@ -274,14 +274,14 @@ For Python projects, you should package the root of your project file and always
274274
275275
### [Continuous Deployment](#tab/continuous-deployment)
276276
277-
Azure Functions has a custom GitHub Action and Azure DevOps Task to support continuous deployment. Refer the following guides to incorporate these tools in your CI/CD pipelines:
277+
Azure Functions has both a custom GitHub Action and a custom Azure Pipelines Task to support continuous deployment. Refer the following guides to incorporate these tools in your CI/CD pipelines:
278278
279279
- [Build and deploy using Azure Pipelines](./functions-how-to-azure-devops.md)
280280
- [Build and deploy using GitHub Actions](./functions-how-to-github-actions.md)
281281
282282
### [Core Tools](#tab/core-tools)
283283
284-
[!INCLUDE [functions-publish-project-CLI-clean](../../includes/functions-publish-project-cli-clean.md)]
284+
[!INCLUDE [functions-publish-project-cli-clean](../../includes/functions-publish-project-cli-clean.md)]
285285
286286
### [Visual Studio Code](#tab/vs-code-publish)
287287
@@ -412,7 +412,7 @@ az functionapp vnet-integration list --resource-group <RESOURCE_GROUP> --name <A
412412

413413
You can integrate your existing app with an existing virtual network and subnet in the portal.
414414

415-
1. In your function app page in the [Azure portal](https://portal.azure.com), expand **Settings** in the left menu and select **Networking**.
415+
1. In your function app page in the [Azure portal], expand **Settings** in the left menu and select **Networking**.
416416

417417
1. Under **Outbound traffic configuration**, select **Not configured**.
418418

@@ -493,7 +493,7 @@ az functionapp deployment config set --resource-group <RESOURCE_GROUP> --name <A
493493

494494
### [Azure portal](#tab/azure-portal)
495495

496-
1. In your function app page in the [Azure portal](https://portal.azure.com), expand **Settings** in the left menu and select **Deployment settings**.
496+
1. In your function app page in the [Azure portal], expand **Settings** in the left menu and select **Deployment settings**.
497497

498498
1. Under Application package location, select an existing **Storage account** and then select an existing empty **container** in the account.
499499

@@ -548,7 +548,7 @@ az functionapp scale config set --resource-group <resourceGroup> --name <APP_NAM
548548

549549
### [Azure portal](#tab/azure-portal)
550550

551-
1. In your function app page in the [Azure portal](https://portal.azure.com), expand **Settings** in the left menu and select **Scale and concurrency**.
551+
1. In your function app page in the [Azure portal], expand **Settings** in the left menu and select **Scale and concurrency**.
552552

553553
1. Select an **Instance memory** option and select **Save** to update the app.
554554

@@ -612,7 +612,7 @@ az functionapp scale config always-ready delete --resource-group <RESOURCE_GROUP
612612

613613
### [Azure portal](#tab/azure-portal)
614614

615-
1. In your function app page in the [Azure portal](https://portal.azure.com), expand **Settings** in the left menu and select **Scale and concurrency**.
615+
1. In your function app page in the [Azure portal], expand **Settings** in the left menu and select **Scale and concurrency**.
616616

617617
1. Under **Always-ready instance minimum** type `http`, `blob`, `durable`, or a specific function name using the format `function:<FUNCTION_NAME>=n` in **Trigger** and type the **Number of always-ready instances**.
618618

@@ -642,7 +642,7 @@ This example sets the HTTP trigger concurrency level to `10`. After you specific
642642

643643
### [Azure portal](#tab/azure-portal)
644644

645-
1. In your function app page in the [Azure portal](https://portal.azure.com), expand **Settings** in the left menu and select **Scale and concurrency**.
645+
1. In your function app page in the [Azure portal], expand **Settings** in the left menu and select **Scale and concurrency**.
646646

647647
1. Under **Concurrency per instance** select **Assign manually** and type a specific limit.
648648

@@ -662,10 +662,134 @@ To view the list of regions that currently support Flex Consumption plans:
662662

663663
When you create an app in the [Azure portal](flex-consumption-how-to.md?tabs=azure-portal#create-a-flex-consumption-app) or by using [Visual Studio Code](flex-consumption-how-to.md?tabs=vs-code#create-a-flex-consumption-app), currently unsupported regions are filtered out of the region list.
664664

665+
## Monitor your app in Azure
666+
667+
Azure Monitor provides these distinct sets of metrics to help you better understand how your function app runs in Azure:
668+
669+
+ Platform metrics: provides infrastructure-level insights
670+
+ Application Insights: provides code-level insights, including traces and errors logs.
671+
672+
If you haven't done so already, you should [enable Application Insights in your app](configure-monitoring.md#enable-application-insights-integration) to be able to:
673+
674+
+ Track detailed execution times and dependencies
675+
+ Monitor individual function performance
676+
+ Analyze failures and exceptions
677+
+ Correlate platform metrics with application behavior with custom queries
678+
679+
For more information, see [Monitor Azure Functions](monitor-functions.md).
680+
681+
### Supported metrics
682+
683+
Run this script to view all of the platform metrics that are currently available your app:
684+
685+
```azurecli
686+
appId=$(az functionapp show --name <APP_NAME> --resource-group <RESOURCE_GROUP> --query id -o tsv)
687+
az monitor metrics list-definitions --resource $appId --query "[].{Name:name.localizedValue,Value:name.value}" -o table
688+
```
689+
690+
In this example, replace `<RESOURCE_GROUP>` and `<APP_NAME>` with your resource group and function app names, respectively. This script gets the fully qualified app ID and returns the available platform metrics in a table.
691+
692+
### View metrics
693+
694+
You can review current metrics either in the Azure portal or by using the Azure CLI.
695+
696+
In the Azure portal, you can also create metrics alerts and pin charts and other reports to dashboards in the portal.
697+
698+
### [Azure CLI](#tab/azure-cli)
699+
700+
Use this script to generate a report of the current metrics for your app:
701+
702+
```azurecli
703+
appId=$(az functionapp show --name <APP_NAME> --resource-group <RESOURCE_GROUP> --query id -o tsv)
704+
705+
appId=$(az functionapp show --name func-fuxigh6c255de --resource-group exampleRG --query id -o tsv)
706+
707+
echo -e "\nAlways-ready and on-emand execution counts..."
708+
az monitor metrics list --resource $appId --metric "AlwaysReadyFunctionExecutionCount" --interval PT1H --output table
709+
az monitor metrics list --resource $appId --metric "OnDemandFunctionExecutionCount" --interval PT1H --output table
710+
711+
echo -e "\nExecution units (MB-ms) in always-ready and on-emand execution counts..."
712+
az monitor metrics list --resource $appId --metric "AlwaysReadyFunctionExecutionUnits" --interval PT1H --output table
713+
az monitor metrics list --resource $appId --metric "OnDemandFunctionExecutionUnits" --interval PT1H --output table
714+
715+
echo -e "\nAlways-ready resource utilization..."
716+
az monitor metrics list --resource $appId --metric "AlwaysReadyUnits" --interval PT1H --output table
717+
718+
echo -e "\nMemory utilization..."
719+
az monitor metrics list --resource $appId --metric "AverageMemoryWorkingSet" --interval PT1H --output table
720+
az monitor metrics list --resource $appId --metric "MemoryWorkingSet" --interval PT1H --output table
721+
722+
echo -e "\nInstance count and CPU utilization..."
723+
az monitor metrics list --resource $appId --metric "InstanceCount" --interval PT1H --output table
724+
az monitor metrics list --resource $appId --metric "CpuPercentage" --interval PT1H --output table
725+
```
726+
727+
### [Azure portal](#tab/azure-portal)
728+
729+
1. In your function app page in the [Azure portal], select **Monitoring** > **Metrics** and if the current chart is blank, select **+ Add metric**.
730+
731+
1. With your app as the **Scope**, choose one or more of the supported **Metric** options to add to the current chart.
732+
733+
1. Repeat the previous step to add other metrics to the chart.
734+
735+
1. (Optional) Select **Save to dashboard** to add the current chart to a new or existing dashboard. Remember to include both always-ready and on-demand metrics for broad visibility.
736+
737+
1. (Optional) Select **New alert rue** to create an alert on a specific metric. Remember to include both always-ready and on-demand metrics for broad visibility.
738+
739+
### [Visual Studio Code](#tab/vs-code)
740+
741+
You can't currently review and set metrics using Visual Studio Code.
742+
743+
---
744+
745+
To learn more about metrics for Azure Functions, see [Monitor Azure Functions](monitor-functions.md).
746+
747+
### View logs
748+
749+
When your app is connected to Application Insights, you can better analyze your app performance and troubleshoot problems during execution.
750+
751+
752+
+ Use "Performance" to analyze response times and dependencies
753+
+ Use "Failures" to identify any errors occurring after migration
754+
+ Create custom queries in "Logs" to analyze function behavior:
755+
756+
```kusto
757+
// Compare success rates by instance
758+
requests
759+
| where timestamp > ago(7d)
760+
| summarize successCount=countif(success == true), failureCount=countif(success == false) by bin(timestamp, 1h), cloud_RoleName
761+
| render timechart
762+
```
763+
764+
### View costs
765+
766+
Because you can tune your app to adjust performance versus operating costs, it's important to track the costs associated with running your app in the Flex Consumption plan.
767+
768+
To view the current costs:
769+
770+
1. In your function app page in the [Azure portal], select the resource group link.
771+
772+
1. In the resource group page, select **Cost Management** > **Cost analysis**.
773+
774+
1. Review the current costs and cost trajectory of the app itself.
775+
776+
1. Optionally, select **Cost Management** > **Alerts** and then **+ Add** to create a new alert for the app.
777+
778+
## Fine-tune your app
779+
780+
The Flex Consumption plan provides several settings that you can tune to refine the performance of your app. Actual performance and costs can vary based on your app-specific workload patterns and configuration. For example, higher [memory instance sizes](./flex-consumption-plan.md#instance-memory) can improve performance for memory-intensive operations but at a higher cost per active period.
781+
782+
Here are some adjustments you can make to fine-tune performance versus cost:
783+
784+
+ [Adjust concurrency settings](./functions-concurrency.md) to maximize throughput per instance.
785+
+ [Choose the appropriate memory size](#configure-instance-memory) for your workload. Higher memory sizes cost more but can improve performance.
786+
665787
## Related content
666788
667789
+ [Azure Functions Flex Consumption plan hosting](flex-consumption-plan.md)
668790
+ [Azure Functions hosting options](functions-scale.md)
669791
670792
[`az functionapp create`]: /cli/azure/functionapp#az-functionapp-create
671793
[remote build]: ./functions-deployment-technologies.md#remote-build
794+
[Azure portal]: https://portal.azure.com
795+

articles/azure-functions/flex-consumption-plan.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,13 @@ You can review end-to-end samples that feature the Flex Consumption plan in the
2020

2121
## Benefits
2222

23-
The Flex Consumption plan builds on the strengths of the Consumption plan, which include dynamic scaling and execution-based billing. With Flex Consumption, you also get these extra features:
23+
The Flex Consumption plan builds on the strengths of the serverless Consumption plan, which include dynamic scaling and execution-based billing. With Flex Consumption, you also get these extra features:
2424

25-
+ [Always-ready instances](#always-ready-instances)
26-
+ [Virtual network integration](#virtual-network-integration)
27-
+ Fast scaling based on concurrency for both HTTP and non-HTTP apps
28-
+ Multiple choices for instance memory sizes
25+
+ **Reduced Cold Start Times**: Enable [always-ready instances](#always-ready-instances) to achieve faster cold-start times compared to the Consumption plan.
26+
+ **Virtual network support**: [Virtual network integration](#virtual-network-integration) enables your serverless app to run in a virtual network.
27+
+ **Per-Function Scaling**: Each function in your app [scales independently based on its workload](#per-function-scaling), potentially resulting in more efficient resource allocation.
28+
+ **Improved Concurrency Handling**: Better handling of concurrent executions with configurable concurrency settings per function.
29+
+ **Flexible Memory Configuration**: Flex Consumption offers multiple [instance memory](#instance-memory) size options, allowing you to optimize for your specific workload requirements.
2930

3031
This table helps you directly compare the features of Flex Consumption with the Consumption hosting plan:
3132

@@ -123,18 +124,18 @@ This table shows the language stack versions that are currently supported for Fl
123124

124125
Currently, each region in a given subscription has a memory limit of `512,000 MB` for all instances of apps running on Flex Consumption plans. This quota means that, in a given subscription and region, you could have any combination of instance memory sizes and counts, as long as they stay under the quota limit. For example, each the following examples would mean the quota is reached and the apps would stop scaling:
125126

126-
+ You have one 512 MB app scaled to 250 instances and a second 512 MB app scaled to 750 instances.
127-
+ You have one 512 MB app scaled to 1,000 instances.
128-
+ You have one 2,048 MB app scaled to 100 and a second 2,048 MB app scaled to 150 instances
129-
+ You have one 2,048 MB app that scaled out to 250 instances
130-
+ You have one 4,096 MB app that scaled out to 125 instances
131-
+ You have one 4,096 MB app scaled to 100 and one 2,048 MB app scaled to 50 instances
127+
+ You have one 512-MB app scaled to 250 instances and a second 512-MB app scaled to 750 instances.
128+
+ You have one 512-MB app scaled to 1,000 instances.
129+
+ You have one 2,048-MB app scaled to 100 and a second 2,048-MB app scaled to 150 instances
130+
+ You have one 2,048-MB app that scaled out to 250 instances
131+
+ You have one 4,096-MB app that scaled out to 125 instances
132+
+ You have one 4,096-MB app scaled to 100 and one 2,048-MB app scaled to 50 instances
132133

133134
Flex Consumption apps scaled to zero, or instances marked to be scaled in and deleted, don't count against the quota. This quota can be increased to allow your Flex Consumption apps to scale further, depending on your requirements. If your apps require a larger quota, create a support ticket.
134135

135136
## Deprecated properties and settings
136137

137-
In Flex Consumption many of the standard application settings and site configuration properties are deprecated or have moved and shouldn't be used when automating function app resource creation. For more information, see [Flex Consumption plan deprecations](functions-app-settings.md#flex-consumption-plan-deprecations).
138+
In the Flex Consumption plan, many of the standard application settings and site configuration properties are deprecated or have moved and shouldn't be used when automating function app resource creation. For more information, see [Flex Consumption plan deprecations](functions-app-settings.md#flex-consumption-plan-deprecations).
138139

139140
## Considerations
140141

articles/azure-functions/functions-bindings-error-pages.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ The retry policy tells the runtime to rerun a failed execution until either succ
8080
A retry policy is evaluated when a function executed by a supported trigger type raises an uncaught exception. As a best practice, you should catch all exceptions in your code and raise new exceptions for any errors that you want to result in a retry.
8181

8282
> [!IMPORTANT]
83-
> Event Hubs checkpoints aren't written until after the retry policy for the execution finishes. Because of this behavior, progress on the specific partition is paused until the current batch is done processing.
83+
> Event Hubs checkpoints aren't written until after the retry policy for the execution finishes. Because of this behavior, progress on the specific partition is paused until the current batch is done processing. For more information, see [Azure Functions reliable event processing](functions-reliable-event-processing.md).
8484
>
8585
> The version 5.x of the Event Hubs extension supports extra retry capabilities for interactions between the Functions host and the event hub. For more information, see `clientRetryOptions` in the [Event Hubs host.json reference](functions-bindings-event-hubs.md#host-json).
8686

articles/azure-functions/functions-develop-vs.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ The Azure Functions project template in Visual Studio creates a C# class library
4747
1. In **Configure your new project**, enter a **Project name** for your project, and then select **Create**. The function app name must be valid as a C# namespace, so don't use underscores, hyphens, or any other nonalphanumeric characters.
4848

4949
1. For the **Create a new Azure Functions application** settings, use the values in the following table:
50-
5150
::: zone pivot="isolated"
51+
5252
| Setting | Value | Description |
5353
| ------------ | ------ |--------------------------------- |
5454
| **.NET version** | **.NET 8 Isolated** | This value creates a function project that runs in an [isolated worker process](dotnet-isolated-process-guide.md). Isolated worker process supports other non-LTS version of .NET and also .NET Framework. For more information, see [Azure Functions runtime versions overview](functions-versions.md). |
@@ -60,6 +60,7 @@ The Azure Functions project template in Visual Studio creates a C# class library
6060

6161
::: zone-end
6262
::: zone pivot="in-proc"
63+
6364
| Setting | Value | Description |
6465
| ------------ | ------ |--------------------------------- |
6566
| **.NET version** | **.NET 8** | This value creates a function project that runs in-process with version 4.x of the Azure Functions runtime. For more information, see [Azure Functions runtime versions overview](functions-versions.md). |

articles/azure-functions/functions-how-to-use-azure-function-app-settings.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,12 @@ In the previous example, replace `<RESOURCE_GROUP>` and `<FUNCTION_APP_NAME>` wi
182182

183183
## Plan migration
184184

185-
You can migrate a function app between a Consumption plan and a Premium plan on Windows. When migrating between plans, keep in mind the following considerations:
185+
You can migrate a function app between a Consumption plan and a Premium plan on Windows.
186+
187+
>[!TIP]
188+
>We recommend you migrate your Consumption plan app to run in a Flex Consumption plan instead of a Premium plan. This is the only migration option for a Linux Consumption plan app. For more information, see [Migrate Consumption plan apps to the Flex Consumption plan](migration/migrate-plan-consumption-to-flex.md).
189+
190+
When migrating between plans, keep in mind the following considerations:
186191

187192
+ Direct migration to a Dedicated (App Service) plan isn't supported.
188193
+ Migration isn't supported on Linux.

0 commit comments

Comments
 (0)