Skip to content

Commit d79e071

Browse files
Merge pull request #310728 from nzthiago/nzthiagopatch1
Azure Functions Flex Consumption updates
2 parents cb0276e + 021eed5 commit d79e071

3 files changed

Lines changed: 261 additions & 2 deletions

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: 256 additions & 1 deletion
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)
@@ -1061,7 +1064,7 @@ There are various ways to create a function app in the Flex Consumption plan alo
10611064
| Visual Studio | [Visual Studio deployment](../functions-develop-vs.md#publish-to-azure) |
10621065
10631066
>[!TIP]
1064-
>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.
1067+
>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
10661069
### Apply migrated app settings in the new app
10671070
@@ -1507,6 +1510,7 @@ After a successful migration, you should perform these follow-up tasks:
15071510
> + [Capture performance benchmarks](#capture-performance-benchmarks)
15081511
> + [Create custom dashboards](#create-custom-dashboards)
15091512
> + [Refine plan settings](#refine-plan-settings)
1513+
> + [Update your Infrastructure as Code](#update-your-infrastructure-as-code)
15101514
> + [Remove the original app (optional)](#remove-the-original-app-optional)
15111515
15121516
### Verify basic functionality
@@ -1565,6 +1569,257 @@ Consider setting-up dashboards and alerts on your key metrics in the Azure porta
15651569

15661570
Actual performance improvements and cost implications of the migration can vary based on your app-specific workloads and configuration. The Flex Consumption plan provides several settings that you can adjust to refine the performance of your app. You might want to make adjustments to more closely match the behavior of the original app or to balance cost versus performance. For more information, see [Fine-tune your app](../flex-consumption-how-to.md#fine-tune-your-app) in the Flex Consumption article.
15671571

1572+
### Update your Infrastructure as Code
1573+
1574+
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.
1575+
1576+
> [!IMPORTANT]
1577+
> 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.
1578+
1579+
#### Key differences
1580+
1581+
When migrating your IaC from Consumption to Flex Consumption, consider these important changes:
1582+
1583+
| Aspect | Consumption plan | Flex Consumption plan |
1584+
| ------ | ---------------- | --------------------- |
1585+
| Hosting plan SKU | `Y1` (Dynamic) | `FC1` (FlexConsumption) |
1586+
| Plan required | Optional (auto-created) | Required (must be explicit) |
1587+
| Operating system | Windows or Linux | Linux only |
1588+
| Configuration | App settings | `functionAppConfig` section |
1589+
| Storage content share | `WEBSITE_CONTENTSHARE` setting | `deployment.storage` in `functionAppConfig` |
1590+
1591+
The examples below demonstrate the key differences between Consumption and Flex Consumption plan resource definitions, and use system assigned managed identity, but they are not complete. They don't include all required resources such as storage accounts, Application Insights, or all necessary role assignments. For complete, production-ready examples, review the [Flex Consumption IaC samples](https://github.com/Azure-Samples/azure-functions-flex-consumption-samples/tree/main/IaC).
1592+
1593+
#### [Bicep](#tab/bicep)
1594+
1595+
**Consumption plan (before):**
1596+
1597+
```bicep
1598+
// Consumption plan (optional - auto-created if omitted)
1599+
resource hostingPlan 'Microsoft.Web/serverfarms@2022-03-01' = {
1600+
name: hostingPlanName
1601+
location: location
1602+
sku: {
1603+
name: 'Y1'
1604+
tier: 'Dynamic'
1605+
}
1606+
properties: {
1607+
reserved: true // Linux
1608+
}
1609+
}
1610+
1611+
resource functionApp 'Microsoft.Web/sites@2022-03-01' = {
1612+
name: functionAppName
1613+
location: location
1614+
kind: 'functionapp,linux'
1615+
properties: {
1616+
serverFarmId: hostingPlan.id
1617+
siteConfig: {
1618+
linuxFxVersion: 'DOTNET-ISOLATED|8.0'
1619+
appSettings: [
1620+
{ name: 'FUNCTIONS_EXTENSION_VERSION', value: '~4' }
1621+
{ name: 'FUNCTIONS_WORKER_RUNTIME', value: 'dotnet-isolated' }
1622+
{ name: 'AzureWebJobsStorage__accountName', value: storageAccount.name }
1623+
{ name: 'WEBSITE_CONTENTAZUREFILECONNECTIONSTRING__accountName', value: storageAccount.name }
1624+
{ name: 'WEBSITE_CONTENTSHARE', value: functionAppName }
1625+
{ name: 'APPLICATIONINSIGHTS_CONNECTION_STRING', value: appInsights.properties.ConnectionString }
1626+
{ name: 'APPLICATIONINSIGHTS_AUTHENTICATION_STRING', value: 'Authorization=AAD' }
1627+
]
1628+
}
1629+
}
1630+
identity: {
1631+
type: 'SystemAssigned'
1632+
}
1633+
}
1634+
```
1635+
1636+
**Flex Consumption plan (after):**
1637+
1638+
```bicep
1639+
// Flex Consumption plan (required)
1640+
resource hostingPlan 'Microsoft.Web/serverfarms@2023-12-01' = {
1641+
name: hostingPlanName
1642+
location: location
1643+
sku: {
1644+
name: 'FC1'
1645+
tier: 'FlexConsumption'
1646+
}
1647+
kind: 'functionapp'
1648+
properties: {
1649+
reserved: true
1650+
}
1651+
}
1652+
1653+
// Deployment storage container (required)
1654+
resource deploymentContainer 'Microsoft.Storage/storageAccounts/blobServices/containers@2023-05-01' = {
1655+
name: '${storageAccount.name}/default/deployments'
1656+
}
1657+
1658+
resource functionApp 'Microsoft.Web/sites@2023-12-01' = {
1659+
name: functionAppName
1660+
location: location
1661+
kind: 'functionapp,linux'
1662+
properties: {
1663+
serverFarmId: hostingPlan.id
1664+
functionAppConfig: {
1665+
deployment: {
1666+
storage: {
1667+
type: 'blobContainer'
1668+
value: '${storageAccount.properties.primaryEndpoints.blob}deployments'
1669+
authentication: {
1670+
type: 'SystemAssignedIdentity'
1671+
}
1672+
}
1673+
}
1674+
scaleAndConcurrency: {
1675+
maximumInstanceCount: 100
1676+
instanceMemoryMB: 2048
1677+
}
1678+
runtime: {
1679+
name: 'dotnet-isolated'
1680+
version: '8.0'
1681+
}
1682+
}
1683+
siteConfig: {
1684+
appSettings: [
1685+
{ name: 'AzureWebJobsStorage__accountName', value: storageAccount.name }
1686+
{ name: 'APPLICATIONINSIGHTS_CONNECTION_STRING', value: appInsights.properties.ConnectionString }
1687+
{ name: 'APPLICATIONINSIGHTS_AUTHENTICATION_STRING', value: 'Authorization=AAD' }
1688+
]
1689+
}
1690+
}
1691+
identity: {
1692+
type: 'SystemAssigned'
1693+
}
1694+
}
1695+
```
1696+
1697+
> [!NOTE]
1698+
> When using `APPLICATIONINSIGHTS_AUTHENTICATION_STRING` with `Authorization=AAD`, you must also assign the **Monitoring Metrics Publisher** role to the function app's managed identity on the Application Insights resource.
1699+
1700+
For complete Bicep examples, see the [Flex Consumption Bicep samples](https://github.com/Azure-Samples/azure-functions-flex-consumption-samples/tree/main/IaC/bicep).
1701+
1702+
#### [Terraform](#tab/terraform)
1703+
1704+
**Consumption plan (before):**
1705+
1706+
```terraform
1707+
resource "azurerm_service_plan" "consumption" {
1708+
name = var.hosting_plan_name
1709+
location = azurerm_resource_group.rg.location
1710+
resource_group_name = azurerm_resource_group.rg.name
1711+
os_type = "Linux"
1712+
sku_name = "Y1"
1713+
}
1714+
1715+
resource "azurerm_linux_function_app" "consumption" {
1716+
name = var.function_app_name
1717+
location = azurerm_resource_group.rg.location
1718+
resource_group_name = azurerm_resource_group.rg.name
1719+
service_plan_id = azurerm_service_plan.consumption.id
1720+
storage_account_name = azurerm_storage_account.sa.name
1721+
storage_uses_managed_identity = true
1722+
1723+
identity {
1724+
type = "SystemAssigned"
1725+
}
1726+
1727+
site_config {
1728+
application_insights_connection_string = azurerm_application_insights.appInsights.connection_string
1729+
application_stack {
1730+
dotnet_version = "8.0"
1731+
use_dotnet_isolated_runtime = true
1732+
}
1733+
}
1734+
1735+
app_settings = {
1736+
"FUNCTIONS_WORKER_RUNTIME" = "dotnet-isolated"
1737+
"APPLICATIONINSIGHTS_AUTHENTICATION_STRING" = "Authorization=AAD"
1738+
}
1739+
}
1740+
```
1741+
1742+
**Flex Consumption plan (after):**
1743+
1744+
```terraform
1745+
resource "azurerm_service_plan" "flex" {
1746+
name = var.functionPlanName
1747+
resource_group_name = azurerm_resource_group.rg.name
1748+
location = var.location
1749+
sku_name = "FC1"
1750+
os_type = "Linux"
1751+
}
1752+
1753+
resource "azurerm_storage_container" "deploymentpackage" {
1754+
name = "deploymentpackage"
1755+
storage_account_id = azurerm_storage_account.sa.id
1756+
container_access_type = "private"
1757+
}
1758+
1759+
locals {
1760+
blobStorageAndContainer = "${azurerm_storage_account.sa.primary_blob_endpoint}deploymentpackage"
1761+
}
1762+
1763+
resource "azurerm_function_app_flex_consumption" "flex" {
1764+
name = var.functionAppName
1765+
resource_group_name = azurerm_resource_group.rg.name
1766+
location = var.location
1767+
service_plan_id = azurerm_service_plan.flex.id
1768+
storage_container_type = "blobContainer"
1769+
storage_container_endpoint = local.blobStorageAndContainer
1770+
storage_authentication_type = "SystemAssignedIdentity"
1771+
runtime_name = var.functionAppRuntime
1772+
runtime_version = var.functionAppRuntimeVersion
1773+
maximum_instance_count = var.maximumInstanceCount
1774+
instance_memory_in_mb = var.instanceMemoryMB
1775+
1776+
identity {
1777+
type = "SystemAssigned"
1778+
}
1779+
1780+
site_config {
1781+
application_insights_connection_string = azurerm_application_insights.appInsights.connection_string
1782+
}
1783+
1784+
app_settings = {
1785+
"AzureWebJobsStorage" = "" # Required: see note below
1786+
"AzureWebJobsStorage__accountName" = azurerm_storage_account.sa.name
1787+
"APPLICATIONINSIGHTS_AUTHENTICATION_STRING" = "Authorization=AAD"
1788+
}
1789+
}
1790+
1791+
resource "azurerm_role_assignment" "storage_roleassignment" {
1792+
scope = azurerm_storage_account.sa.id
1793+
role_definition_name = "Storage Blob Data Owner"
1794+
principal_id = azurerm_function_app_flex_consumption.flex.identity.0.principal_id
1795+
principal_type = "ServicePrincipal"
1796+
}
1797+
```
1798+
1799+
> [!NOTE]
1800+
> 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.
1801+
1802+
For complete Terraform examples, see the [Flex Consumption Terraform samples](https://github.com/Azure-Samples/azure-functions-flex-consumption-samples/tree/main/IaC/terraformazurerm).
1803+
1804+
---
1805+
1806+
#### Reconciling IaC after migration
1807+
1808+
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:
1809+
1810+
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.
1811+
1812+
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:
1813+
+ **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.
1814+
+ **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.
1815+
1816+
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.
1817+
1818+
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.
1819+
1820+
> [!TIP]
1821+
> 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.
1822+
15681823
### Remove the original app (optional)
15691824

15701825
After thoroughly testing your new Flex Consumption function app and validating that everything is working as expected, you might want to clean up resources to avoid unnecessary costs. Even though triggers in the original app are likely already disabled, you might wait a few days or even weeks before removing the original app entirely. This delay, which depends on your application's usage patterns, makes sure that all scenarios, including infrequent ones, are properly tested. Only after you're satisfied with the migration results, should you proceed to remove 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)