Skip to content

Commit b9711fa

Browse files
committed
Adding IaC to migration. Adding note about proxies.
1 parent 56fd730 commit b9711fa

3 files changed

Lines changed: 247 additions & 1 deletion

File tree

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ This table helps you directly compare the features of Flex Consumption with the
4141

4242
For a complete comparison of the Flex Consumption plan against the Consumption plan and all other plan and hosting types, see [function scale and hosting options](functions-scale.md).
4343

44+
> [!TIP]
45+
> If you're migrating from the Linux Consumption plan, see [Migrate Consumption plan apps to the Flex Consumption plan](migration/migrate-plan-consumption-to-flex.md?pivots=platform-linux) for step-by-step migration instructions and important differences between the plans.
46+
4447
## Virtual network integration
4548

4649
Flex Consumption expands on the traditional benefits of Consumption plan by adding support for [virtual network integration](./functions-networking-options.md#virtual-network-integration). When your apps run in a Flex Consumption plan, they can connect to other Azure services secured inside a virtual network. All while still allowing you to take advantage of serverless billing and scale, together with the scale and throughput benefits of the Flex Consumption plan. For more information, see [Enable virtual network integration](./flex-consumption-how-to.md#enable-virtual-network-integration).
@@ -191,6 +194,7 @@ Keep these other considerations in mind when using Flex Consumption plan:
191194
+ **PowerShell Managed dependencies**: Flex Consumption doesn't support [managed dependencies in PowerShell](functions-reference-powershell.md#managed-dependencies-feature). You must instead [upload modules with app content](functions-reference-powershell.md#including-modules-in-app-content).
192195
+ **Certificates**: Loading certificates with the WEBSITE_LOAD_CERTIFICATES app setting, managed certificates, app service certificates, and other platform certificate-based features like endToEndEncryptionEnabled are currently not supported.
193196
+ **Timezones**: `WEBSITE_TIME_ZONE` and `TZ` app settings aren't currently supported when running on Flex Consumption plan.
197+
+ **Azure Functions Runtime Version and Proxies**: Flex Consumption only supports version 4.x and later of the Azure Functions runtime. Azure Functions proxies was a feature of versions 1.x through 3.x of the Azure Functions runtime and is not available in Flex Consumption.
194198

195199
## Related articles
196200

articles/azure-functions/migration/migrate-plan-consumption-to-flex.md

Lines changed: 242 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@ This command automatically scans your subscription and returns two arrays:
107107
- **eligible_apps**: Linux Consumption apps that can be migrated to Flex Consumption. These apps are compatible with Flex Consumption.
108108
- **ineligible_apps**: Apps that can't be migrated, along with the specific reasons why. The reasons for incompatibility need to be reviewed and addressed before continuing.
109109

110+
> [!NOTE]
111+
> This command only evaluates function apps running on the **Linux Consumption plan**. Apps running on other hosting plans (Windows Consumption, Premium, Dedicated, or Flex Consumption) won't appear in either the `eligible_apps` or `ineligible_apps` arrays. If you have many function apps and aren't sure which hosting plan each one uses, you can run `az functionapp list --query "[].{name:name, sku:sku}" -o table` to see all apps and their SKUs, where `Dynamic` indicates a Consumption plan app.
112+
110113
The output includes the app name, resource group, location, and runtime stack for each app, along with eligibility status and migration readiness information.
111114

112115
### [Azure portal](#tab/azure-portal)
@@ -1063,6 +1066,245 @@ There are various ways to create a function app in the Flex Consumption plan alo
10631066
>[!TIP]
10641067
>When possible, you should use Microsoft Entra ID for authentication instead of connection strings, which contain shared keys. Using managed identities is a best practice that improves security by eliminating the need to store shared secrets directly in application settings. If your original app used connection strings, the Flex Consumption plan is designed to support managed identities. Most of these links show you how to enable managed identities in your function app.
10651068
1069+
### Migrate your Infrastructure as Code
1070+
1071+
If you manage your function app infrastructure using Bicep or Terraform, you need to update your IaC files to target the Flex Consumption plan. This section shows the key differences between Consumption and Flex Consumption plan resource definitions.
1072+
1073+
> [!IMPORTANT]
1074+
> You can't convert an existing Consumption plan app to Flex Consumption in place. You need to create new resources with a new name or delete the existing resources before deploying the Flex Consumption equivalents.
1075+
1076+
#### Key differences
1077+
1078+
When migrating your IaC from Consumption to Flex Consumption, consider these important changes:
1079+
1080+
| Aspect | Consumption plan | Flex Consumption plan |
1081+
| ------ | ---------------- | --------------------- |
1082+
| Hosting plan SKU | `Y1` (Dynamic) | `FC1` (FlexConsumption) |
1083+
| Plan required | Optional (auto-created) | Required (must be explicit) |
1084+
| Operating system | Windows or Linux | Linux only |
1085+
| Configuration | App settings | `functionAppConfig` section |
1086+
| Storage content share | `WEBSITE_CONTENTSHARE` setting | `deployment.storage` in `functionAppConfig` |
1087+
1088+
Example:
1089+
1090+
#### [Bicep](#tab/bicep)
1091+
1092+
**Consumption plan (before):**
1093+
1094+
```bicep
1095+
// Consumption plan (optional - auto-created if omitted)
1096+
resource hostingPlan 'Microsoft.Web/serverfarms@2022-03-01' = {
1097+
name: hostingPlanName
1098+
location: location
1099+
sku: {
1100+
name: 'Y1'
1101+
tier: 'Dynamic'
1102+
}
1103+
properties: {
1104+
reserved: true // Linux
1105+
}
1106+
}
1107+
1108+
resource functionApp 'Microsoft.Web/sites@2025-03-01' = {
1109+
name: functionAppName
1110+
location: location
1111+
kind: 'functionapp,linux'
1112+
properties: {
1113+
serverFarmId: hostingPlan.id
1114+
siteConfig: {
1115+
linuxFxVersion: 'DOTNET-ISOLATED|8.0'
1116+
appSettings: [
1117+
{ name: 'FUNCTIONS_EXTENSION_VERSION', value: '~4' }
1118+
{ name: 'FUNCTIONS_WORKER_RUNTIME', value: 'dotnet-isolated' }
1119+
{ name: 'AzureWebJobsStorage', value: storageConnectionString }
1120+
{ name: 'WEBSITE_CONTENTAZUREFILECONNECTIONSTRING', value: storageConnectionString }
1121+
{ name: 'WEBSITE_CONTENTSHARE', value: functionAppName }
1122+
]
1123+
}
1124+
}
1125+
}
1126+
```
1127+
1128+
**Flex Consumption plan (after):**
1129+
1130+
```bicep
1131+
// Flex Consumption plan (required)
1132+
resource hostingPlan 'Microsoft.Web/serverfarms@2025-03-01' = {
1133+
name: hostingPlanName
1134+
location: location
1135+
sku: {
1136+
name: 'FC1'
1137+
tier: 'FlexConsumption'
1138+
}
1139+
kind: 'functionapp'
1140+
properties: {
1141+
reserved: true
1142+
}
1143+
}
1144+
1145+
// Deployment storage container (required)
1146+
resource deploymentContainer 'Microsoft.Storage/storageAccounts/blobServices/containers@2023-05-01' = {
1147+
name: '${storageAccount.name}/default/deployments'
1148+
}
1149+
1150+
resource functionApp 'Microsoft.Web/sites@2025-03-01' = {
1151+
name: functionAppName
1152+
location: location
1153+
kind: 'functionapp,linux'
1154+
properties: {
1155+
serverFarmId: hostingPlan.id
1156+
functionAppConfig: {
1157+
deployment: {
1158+
storage: {
1159+
type: 'blobContainer'
1160+
value: '${storageAccount.properties.primaryEndpoints.blob}deployments'
1161+
authentication: {
1162+
type: 'SystemAssignedIdentity'
1163+
}
1164+
}
1165+
}
1166+
scaleAndConcurrency: {
1167+
maximumInstanceCount: 100
1168+
instanceMemoryMB: 2048
1169+
}
1170+
runtime: {
1171+
name: 'dotnet-isolated'
1172+
version: '8.0'
1173+
}
1174+
}
1175+
siteConfig: {
1176+
appSettings: [
1177+
{ name: 'AzureWebJobsStorage__accountName', value: storageAccount.name }
1178+
{ name: 'APPLICATIONINSIGHTS_CONNECTION_STRING', value: appInsights.properties.ConnectionString }
1179+
]
1180+
}
1181+
}
1182+
identity: {
1183+
type: 'SystemAssigned'
1184+
}
1185+
}
1186+
```
1187+
1188+
For complete Bicep examples, see the [Flex Consumption Bicep samples](https://github.com/Azure-Samples/azure-functions-flex-consumption-samples/tree/main/IaC/bicep).
1189+
1190+
#### [Terraform](#tab/terraform)
1191+
1192+
**Consumption plan (before):**
1193+
1194+
```terraform
1195+
resource "azurerm_service_plan" "consumption" {
1196+
name = var.hosting_plan_name
1197+
location = azurerm_resource_group.rg.location
1198+
resource_group_name = azurerm_resource_group.rg.name
1199+
os_type = "Linux"
1200+
sku_name = "Y1"
1201+
}
1202+
1203+
resource "azurerm_linux_function_app" "consumption" {
1204+
name = var.function_app_name
1205+
location = azurerm_resource_group.rg.location
1206+
resource_group_name = azurerm_resource_group.rg.name
1207+
service_plan_id = azurerm_service_plan.consumption.id
1208+
storage_account_name = azurerm_storage_account.sa.name
1209+
storage_account_access_key = azurerm_storage_account.sa.primary_access_key
1210+
1211+
site_config {
1212+
application_stack {
1213+
dotnet_version = "8.0"
1214+
use_dotnet_isolated_runtime = true
1215+
}
1216+
}
1217+
1218+
app_settings = {
1219+
"FUNCTIONS_WORKER_RUNTIME" = "dotnet-isolated"
1220+
}
1221+
}
1222+
```
1223+
1224+
**Flex Consumption plan (after):**
1225+
1226+
```terraform
1227+
resource "azurerm_service_plan" "flex" {
1228+
name = var.functionPlanName
1229+
resource_group_name = azurerm_resource_group.rg.name
1230+
location = var.location
1231+
sku_name = "FC1"
1232+
os_type = "Linux"
1233+
}
1234+
1235+
resource "azurerm_storage_container" "deploymentpackage" {
1236+
name = "deploymentpackage"
1237+
storage_account_id = azurerm_storage_account.sa.id
1238+
container_access_type = "private"
1239+
}
1240+
1241+
locals {
1242+
blobStorageAndContainer = "${azurerm_storage_account.sa.primary_blob_endpoint}deploymentpackage"
1243+
}
1244+
1245+
resource "azurerm_function_app_flex_consumption" "flex" {
1246+
name = var.functionAppName
1247+
resource_group_name = azurerm_resource_group.rg.name
1248+
location = var.location
1249+
service_plan_id = azurerm_service_plan.flex.id
1250+
storage_container_type = "blobContainer"
1251+
storage_container_endpoint = local.blobStorageAndContainer
1252+
storage_authentication_type = "SystemAssignedIdentity"
1253+
runtime_name = var.functionAppRuntime
1254+
runtime_version = var.functionAppRuntimeVersion
1255+
maximum_instance_count = var.maximumInstanceCount
1256+
instance_memory_in_mb = var.instanceMemoryMB
1257+
1258+
identity {
1259+
type = "SystemAssigned"
1260+
}
1261+
1262+
site_config {
1263+
application_insights_connection_string = azurerm_application_insights.appInsights.connection_string
1264+
}
1265+
1266+
app_settings = {
1267+
"AzureWebJobsStorage" = "" # Required: see note below
1268+
"AzureWebJobsStorage__accountName" = azurerm_storage_account.sa.name
1269+
}
1270+
}
1271+
1272+
resource "azurerm_role_assignment" "storage_roleassignment" {
1273+
scope = azurerm_storage_account.sa.id
1274+
role_definition_name = "Storage Blob Data Owner"
1275+
principal_id = azurerm_function_app_flex_consumption.flex.identity.0.principal_id
1276+
principal_type = "ServicePrincipal"
1277+
}
1278+
```
1279+
1280+
> [!NOTE]
1281+
> When using the `azurerm` provider with Flex Consumption, you must set `AzureWebJobsStorage` to an empty string (`""`) as a workaround until [this fix](https://github.com/hashicorp/terraform-provider-azurerm/pull/29099) is released. Use `AzureWebJobsStorage__accountName` with managed identity authentication for the actual storage connection.
1282+
1283+
For complete Terraform examples, see the [Flex Consumption Terraform samples](https://github.com/Azure-Samples/azure-functions-flex-consumption-samples/tree/main/IaC/terraformazurerm).
1284+
1285+
---
1286+
1287+
#### Settings that moved to functionAppConfig
1288+
1289+
Many app settings used in Consumption plan are now configured in the `functionAppConfig` section for Flex Consumption. Don't include these deprecated settings in your Flex Consumption app. For a complete list of deprecated settings and their replacements, see [Flex Consumption plan deprecations](../functions-app-settings.md#flex-consumption-plan-deprecations).
1290+
1291+
#### Reconciling IaC after migration
1292+
1293+
If you use Infrastructure as Code (IaC) to manage your Azure resources, you need to update your IaC files after migrating to Flex Consumption to prevent configuration drift. Here's a recommended approach:
1294+
1295+
1. **Don't mix manual and IaC deployments**: If you used the Azure CLI or portal to create your Flex Consumption app during migration, update your IaC files before the next deployment. Otherwise, your IaC might attempt to recreate the old Consumption plan resources.
1296+
1297+
2. **Update resource names or use lifecycle management**: Since you can't convert a Consumption app to Flex Consumption in place, you have two options:
1298+
+ **New resource names**: Update your IaC to use new names for the hosting plan and function app. This approach keeps your old resources intact until you're confident the migration succeeded.
1299+
+ **Import existing resources**: If you want to keep the same names, delete the old resources first, then let your IaC create the new Flex Consumption resources. Alternatively, import the manually-created resources into your Terraform state using `terraform import` or reference existing resources in Bicep.
1300+
1301+
3. **Verify state alignment**: After updating your IaC files, run a plan/preview operation (`terraform plan` or `az deployment group what-if`) to confirm no unexpected changes will occur.
1302+
1303+
4. **Update CI/CD pipelines**: If your deployment pipelines reference the old Consumption plan configuration, update them to use the new Flex Consumption resource definitions and deployment methods.
1304+
1305+
> [!TIP]
1306+
> To minimize disruption, consider running both the old Consumption app and new Flex Consumption app in parallel during a transition period. Update your IaC to manage the new Flex Consumption app, verify it works correctly, then remove the old Consumption app resources from both Azure and your IaC files.
1307+
10661308
### Apply migrated app settings in the new app
10671309

10681310
Before deploying your code, you must configure the new app with the relevant Flex Consumption plan app settings from your original function app.

includes/functions-dotnet-supported-versions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ The following table shows the highest level of .NET or .NET Framework that can b
3030

3131
<sup>4</sup> Support ends for the in-process model on November 10, 2026. For more information, see [this support announcement](https://aka.ms/azure-functions-retirements/in-process-model). For continued full support, you should [migrate your apps to the isolated worker model](../articles/azure-functions/migrate-dotnet-to-isolated-model.md).
3232

33-
<sup>5</sup> You can't run .NET 10 apps on Linux in the Consumption plan. To run on Linux, you should instead use the [Flex Consumption plan](../articles/azure-functions/flex-consumption-plan.md).
33+
<sup>5</sup> You can't run .NET 10 apps on Linux in the Consumption plan. To run on Linux, you should instead use the [Flex Consumption plan](../articles/azure-functions/flex-consumption-plan.md). For step-by-step migration instructions, see [Migrate Consumption plan apps to the Flex Consumption plan](../articles/azure-functions/migration/migrate-plan-consumption-to-flex.md?pivots=platform-linux).
3434

3535
For the latest news about Azure Functions releases, including the removal of specific older minor versions, monitor [Azure App Service announcements](https://github.com/Azure/app-service-announcements/issues).
3636

0 commit comments

Comments
 (0)