Jessica
Jessica

Reputation: 2061

Creating multiple function apps with one Flex Consumption plan

I'm attempting to create some function apps using a flex consumption plan.

Currently, multiple of my function apps are deployed to a single "consumption" app service plan, so I thought I'd be able to do the same with FC.

I'm able to create the first function app in the FC plan like this (which creates the plan):

az functionapp create --resource-group $rg --name $fnName --storage-account $sa --runtime dotnet-isolated --runtime-version 8.0 --flexconsumption-location "uksouth"

Then, I attempt to create the second function app in the same plan like this:

az functionapp create --resource-group $rg --name $fnNameTwo --storage-account $saTwo --runtime dotnet-isolated --runtime-version 8.0 --plan $flexConsumptionPlan

However, this fails with this error message:

There is already a site linked to the specified Flex Consumption Plan serverfarm [name_here]. There can only be one site per Flex Consumption serverfarm.

I can't find this anywhere in the documentation for Flex Consumption. Is this a bug? Or will I need to use a single server farm per function app? What about scaling?

I get the same issue when I try to deploy with Bicep.

Any help, advice or documentation links would be much appreciated.

Thanks!

Upvotes: 2

Views: 595

Answers (2)

Thiago Almeida
Thiago Almeida

Reputation: 166

Azure Functions Flex Consumption has indeed a limit of one function app per plan. The Azure Function Limits documentation has been updated to reflect that. Because the concurrency based scaling of Flex Consumption aims to be deterministic, the product group decided not to allow for multiple function apps in the same plan all voting independently to scale. You can still have different triggered functions inside the same Flex Consumption function app though, and these would scale into their own instances as described in per-function scaling.

Upvotes: 1

Jahnavi
Jahnavi

Reputation: 8018

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

The above message is not exactly an error. It is a limitation of flex consumption plan.

Limitation:

Two or more function apps cannot share the same flex consumption app plan.

As detailed here in the video, Flex consumption plan doesn't share a plan with two function apps unlike standard consumption plan. You need a create a new flex consumption location every time you create a new function app.

I have tried to achieve your requirement using bicep and CLI but could not be able to deploy another function app in the same flex plan as shown below.

enter image description here

Flex plan has an advantage of scaling up the instances automatically based on the functions executing in an app and also added a special feature of vnet integration in this flex consumption plan. Flex consumption plan settings are also configured at the app level automatically.

Refer MSDoc for the relevant information on flex consumption hosting.

I have tried creating and deploying two function apps in different flex consumption plans and was able to perform the operation successfully.

az functionapp create --resource-group Jahnavi --name newapsj --storage-account jahnavia8c2 --runtime dotnet-isolated --runtime-version 8.0 --flexconsumption-location "uksouth"

enter image description here

az functionapp create --resource-group Jahnavi --name newapsjah1 --storage-account storenewjhsd --runtime dotnet-isolated --runtime-version 8.0 --instance-memory 4096 --flexconsumption-location "NorthEurope"

enter image description here

Note: If you still want to deploy two or more apps in the same plan, you need to go with a specific app service farm rather than using the flex consumption.

Upvotes: 2

Related Questions