azure-cli: Unable to create function app against existing consumption plan

Describe the bug It is not possible to create a function app against a specified consumption app service plan. The following error occurs:

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

I think that setting --consumption-plan-location disables AlwaysOn, but --plan doesn’t.

To Reproduce

  1. Create a consumption plan (see “Additional context” section)
  2. Try to create a function app against the plan created in step 1: az functionapp create --resource-group myresourcegroup --storage-account mystorageaccount --name myfunction --plan PlanFromStepOne
  3. Get the error:

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

Expected behavior It should create the function app against the specified plan, and not set “AlwaysOn” if the plan does not support it.

Environment summary Install method: MSI CLI version: 2.0.52 OS version: Windows 10, Version 1803, OS Build 17134.523 Shell type: cmd

Additional context You can create a consumption app service plan in two ways.

The first way will create a plan called “NorthEuropePlan” with no option to specify the name (it’s also part of creating a function app, rather than a discrete step):

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

The second is to use the az resource command. I consider this a much better approach as it is a discrete step, and also lets you specify the name:

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

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Reactions: 24
  • Comments: 54 (6 by maintainers)

Most upvoted comments

I’ve also ran into this issue. Creating a functionapp with Consumption Plan with a name that conforms to our naming convention is a breeze in ARM, but to create it with Azure CLI, I had to do a horrible workaround:

  1. Create a consumption plan like @Jameskmonger described

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

  1. Create a function app with the --consumption-plan-location i.e.

az functionapp create --resource-group myresourcegroup --name myfunctionapp --consumption-plan-location westeurope

  1. Update the functionapp to use the plan created in step 1 i.e.

az functionapp update --resource-group myresourcegroup --name myfunctionapp --plan myconsumptionplan

  1. Delete the consumption plan auto generated in step 2 i.e. (I prefer az resource delete for this)

az resource delete --name WestEurope --resource-group myresourcegroup

I’ve also found that ver 2.0.8 Azure CLI does not give the “Always On” issue that @Jameskmonger described, but 2.3.1 and 2.4.0 do. But regardless, it just makes sense to be able to specify a newly created consumption plan name for a functionapp in the Azure-CLI and in my opinion should be implemented a.s.a.p.

@pfranco22 What if I already have a consumption plan and I want to create a new app against that plan? --consumption-plan-location does not meet that requirement

Hi, if you are using an Consumption Plan (Dynamic) you only need to set --consumption-plan-location, not --plan. Consumption plans does not allow Always-On. If you create an App Service plan, then you can use Always On.

This is extremely bad, I should be able to use an F1 free tier plan, which I can through the portal, but via the az cli it assumes for some reason that always on is true even though I don’t need always on. Also using consumption based ruins our naming standards as we can’t control the name of the auto generated plan, so that is not an option either. Please default to always on false, or give us the option to set that flag via the cli (az functionapp create).

@norvegec I hope the fact that a lot of the work done by the team is in the open provides good evidence that the team has been addressing problems. Issues do need to be prioritized and, unfortunately, as much as we would love to, particularly with the challenges we all had to deal with this previous year, we can’t always address them in a timely manner. I do agree that there should have been a response and proper triage on this, and I’m sorry this didn’t happen (it looks like this was created prior to some processes that would trigger the triage and somehow, feel through). I’m flagging this for discussion in the next triage meeting.

@apawast can we please add this to our next triage list? We may need to loop in Web Apps (Antares) folks as the plan for consumption differs from a traditional plan and there might be some limitations there. At the very least, we need to have clear documentation and guidance on this so we can have closure on this issue.

Come ON, Microsoft. How difficult is it to fix this?

@Jameskmonger Apologies for the late reply. I am able to create function app with existing consumption plan now. Did you get a chance to test this and check? This issue is open for quite sometime now. Could you please let us know if you need any assistance on this ? Awaiting your reply.

Hi, we’re sending this friendly reminder because we haven’t heard back from you in a while. We need more information about this issue to help address it. Please be sure to give us your input within the next 7 days. If we don’t hear back from you within 14 days of this comment the issue will be automatically closed. Thank you!

The issue still exists: You cannot specify the name of the consumption plan when creating a new function app. The name of the consumption plan is based on the location, which is not desired.

A --consumption-plan-name option for az functionapp create […] would be great.

Used in conjunction with --consumption-plan-location, the value of --consumption-plan-name would be the name of the generated app service plan (instead of the current app service plan naming convention of camel-cased consumption plan location + Plan e.g. NorthEuropePlan).

So if my command was something like…

$ az functionapp create --consumption-plan-location australiaeast --consumption-plan-name hello-world [etc…]

…the generated app service plan would be named hello-world and not AustraliaEastPlan.

Apologies for being so long-winded—just want to ensure my suggestion is crystal clear.

Cheers!

🤓 🙏

Hi, if you are using an Consumption Plan (Dynamic) you only need to set --consumption-plan-location, not --plan. Consumption plans does not allow Always-On. If you create an App Service plan, then you can use Always On.

Sorry, but this method creates a very bad name for the consumption plan. If you have 5 azure functions in north europe, they will all be named NorthEuropePlan.

The issue still exists: You cannot specify the name of the consumption plan when creating a new function app. The name of the consumption plan is based on the location, which is not desired.

On Fri, 11 Mar 2022 at 15:01, msftbot[bot] @.***> wrote:

Hi, we’re sending this friendly reminder because we haven’t heard back from you in a while. We need more information about this issue to help address it. Please be sure to give us your input within the next 7 days. If we don’t hear back from you within 14 days of this comment the issue will be automatically closed. Thank you!

— Reply to this email directly, view it on GitHub https://github.com/Azure/azure-cli/issues/8388#issuecomment-1065139910, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAESECQWWXNHDXO2GL3S2DLU7NG2DANCNFSM4GTJZ3HQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

Spoke with Azure Support - trying to create a Linux consumption plan with a custom name will return a 500 error, which seems to be a “works as designed”. I may be in the minority, but that seems a little, uhm, wrong.

So it looks like something is fundamentally broken in Azure that needs to be fixed before this feature can be supported.

I have the same issue and I’m using the latest version of the CLI (as of this writing it’s v2.0.69).

Is there a way to create a functionapp without setting “AlwaysOn”?

I have the same issue with an App Service, when I try to create a Service Plan and then assign to a shared SKU App Service I got this message

az appservice plan create --name "MyAwesomePlan" --resource-group "Super" --location "canadacentral" --sku SHARED az webapp create -g "Super" -p "MyAwesomePlan" -n "MySuperWebApp" --verbose

Is possible to still doing so or cancel the property of Always On from Az CLI?

Create consumption plan using ‘az resource create --name myconsumptionplan …’ as described above in the resource group where function app will be created. Then create function app with ‘…–consumption-plan-location mylocation…’ in the resource group. This function app will use myconsumptionplan created, but not mylocationPlan. Just tested.

This is not a CLI issue - I don’t think this is possible on any client during functionapp create. @fabiocav can you comment on this?

It is possible with an ARM template.

@fabiocav Problems have been addressed, yes, but they honestly haven’t been addressed as quickly as they should have been. I don’t blame you or other teams that are similarly slow to provide feedback (NuGet comes to mind), because I’m quite certain that the reason is that you simply don’t have enough people to deal with the number of issues reported. That’s a management problem not a dev team problem, but unfortunately since the dev team (you) are the only points of contact for customers, you are the ones feeling the pain.

And that sucks, but… as a paying customer none of the above should be my responsibility or concern. If Microsoft is going to understaff its product teams in order to maximize shareholder profits that’s their choice, but then they shouldn’t be surprised when customers get unhappy and/or start jumping ship to AWS.