1
votes

I have created a function app against a new consumption plan with the following command:

az functionapp create
    --resource-group myresourcegroup 
    --storage-account mystorageaccount 
    --name myfunctionapp
    --runtime node
    --consumption-plan-location northeurope 

This creates the function app correctly, but the app service plan is called NorthEuropePlan, which does not meet the naming guidelines I am following. I cannot see anything in the docs that will allow me to change this name.

Therefore, I would like to create the app service plan before, as a consumption plan (tier Y1 Dynamic), and then create a function app against this plan.

az resource create
    --resource-group myresourcegroup
    --name myconsumptionplan
    --resource-type Microsoft.web/serverfarms
    --is-full-object
    --properties "{\"location\":\"northeurope\",\"sku\":{\"name\":\"Y1\",\"tier\":\"Dynamic\"}}"

That command works correctly, and creates me an app service plan. However, when I try to use that plan (substituting --consumption-plan-location northeurope for --plan myconsumptionplan), I get this error:

There was a conflict. AlwaysOn cannot be set for this site as the plan does not allow it.

Do I need to specify some more configuration when I make the app service plan?

When I run az appservice plan show against NorthEuropePlan and myconsumptionplan, the only difference in the object that comes back is the name.

1
Is AlwaysOn an option that you can provide for either the function app or the resource?Henry Ing-Simmons
@HenryIng-Simmons I believe that it's a setting against a Function App, it's on by default and can be turned off through the UI, but only once the Function App is made. I can't see a way to stop it being on by defaultJames Monger

1 Answers

2
votes

When you are using --plan I believe the run time will think it is an App Service Plan and will configure Always ON which is not allowed in consumption plan so I guess you cannot do it like the way you are doing.

You can achieve it with ARM template though. Below is the example command:

az group create 
        --name ExampleGroup 
        --location "North Europe"

az group deployment create 
        --name ExampleDeployment 
        --resource-group ExampleGroup 
        --template-uri "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/101-function-app-create-dynamic/azuredeploy.json"

The URL mentioned in the template-uri is sample template which will create consumption-pan, storage and functionapp.

Deployment will ask the name of parameters (appName) at runtime.