azure-cli icon indicating copy to clipboard operation
azure-cli copied to clipboard

Cannot create consumption function app plan

Open davidstarkcab opened this issue 6 years ago • 25 comments

az feedback auto-generates most of the information requested below, as of CLI version 2.0.76

Describe the bug Cannot create azure function app plan of type consumption? Get following error message:

Invalid sku(pricing tier), please refer to command help for valid values

To Reproduce

Run following command:

az functionapp plan create --name myplan --resource-group mygroup --location westeurope --sku Y1

or

az functionapp plan create --name myplan --resource-group mygroup --location westeurope --sku Dynamic

Expected behavior

Creates a consumption function app plan in azure

Environment summary Install CLI version 2.0.76

Additional context Have tried both Y1 and Dynamic and it doesn't work? Would be nice to have some examples what values it should be for the sku in the documentation also?

davidstarkcab avatar Nov 12 '19 13:11 davidstarkcab

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @ ahmedelnably, @fabiocav

ghost avatar Nov 13 '19 02:11 ghost

@David-Stark did you find a solution or work around for this?

chbe8475 avatar Feb 20 '20 14:02 chbe8475

I am also wondering about this one. I want to provision the function in the Azure DevOps pipeline using the "Azure Cli task"

markusfoss avatar Apr 14 '20 12:04 markusfoss

I would love to have this option so that I can downgrade my ASE from premium to consumption.

danielkon96 avatar May 01 '20 22:05 danielkon96

We currently don't support the ability to create a consumption plan by itself. For downgrade scenarios from Premium to Consumption, please create a new function app for the time being. We'll look into whether we can enable this.

anthonychu avatar May 12 '20 18:05 anthonychu

@anthonychu is there a way to set the name of the created dynamic plan? I would like to get it to follow our conventions, the dynamic plan name sticking out just doesn't look all the professional.

Silvenga avatar Aug 26 '20 17:08 Silvenga

@chbe8475 Sorry i have not =/

@Silvenga Yeah i wonder the same

davidstarkcab avatar Sep 01 '20 13:09 davidstarkcab

It's not an optimal solution, but until they add this functionality to az cli, here's a small ARM template that will let you customize the name of the ASP (obviously you'll want to change the region to suit your needs):

{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "asp-name": {
            "defaultValue": "THE-NAME-OF-THE-APP-SERVICE-PLAN-GOES-HERE",
            "type": "String"
        },
        "region-name": {
            "defaultValue": "West US",
            "type": "String"
        }
    },
    "variables": {},
    "resources": [
        {
            "type": "Microsoft.Web/serverfarms",
            "apiVersion": "2018-02-01",
            "name": "[parameters('asp-name')]",
            "location": "[parameters('region-name')]",
            "sku": {
                "name": "Y1",
                "tier": "Dynamic",
                "size": "Y1",
                "family": "Y",
                "capacity": 0
            },
            "kind": "functionapp",
            "properties": {
                "perSiteScaling": false,
                "maximumElasticWorkerCount": 1,
                "isSpot": false,
                "reserved": false,
                "isXenon": false,
                "hyperV": false,
                "targetWorkerCount": 0,
                "targetWorkerSizeId": 0
            }
        }
    ]
}

nexxai avatar Oct 30 '20 21:10 nexxai

Still no fix?

mildsar avatar Jan 18 '22 07:01 mildsar

function service team should look into this

yonzhan avatar Jan 18 '22 08:01 yonzhan

Just discovered this too. I wanted to control the name of the app service plan that is created for me. E.g

az functionapp create \
  --name $functionAppName \
  --resource-group $resourceGroup \
  --storage-account $storageName \
  --app-insights $appInsightsName \
  --consumption-plan-location westeurope \
  --functions-version 4 \
  --os-type Windows \
  --runtime powershell \
  --runtime-version 7.0

Creates an app service plan resource of the name WestEuropePlan.

I tried adding in az functionapp plane create only to discover I can't if targeting the consumption tier.

danijam avatar Feb 14 '22 15:02 danijam

Absolutely ridiculous that the only way to create a consumption plan is via an ARM template.

Either allow us to edit the plan name in the portal UI when the function app service is created, or allow us to create a consumption plan via the cli.

holtalanm avatar Feb 15 '22 17:02 holtalanm

Currently, this is the workaround I use to create a consumption plan and to let it have a name I choose: https://github.com/Azure/azure-cli/issues/8388#issuecomment-618601562

thomasddn avatar Feb 24 '22 14:02 thomasddn

@davidstarkcab Apologies for the late reply. Could you please check this and this and see if it helps? Awaiting your reply.

navba-MSFT avatar Mar 21 '22 10:03 navba-MSFT

@navba-MSFT No problems! What i can see from these commands is that they will only create a new azure function? I want to be able to set the name on the plan.

davidstarkcab avatar Mar 21 '22 11:03 davidstarkcab

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @Stefanus Hinardi, @Francisco-Gamino.

Issue Details

az feedback auto-generates most of the information requested below, as of CLI version 2.0.76

Describe the bug Cannot create azure function app plan of type consumption? Get following error message:

Invalid sku(pricing tier), please refer to command help for valid values

To Reproduce

Run following command:

az functionapp plan create --name myplan --resource-group mygroup --location westeurope --sku Y1

or

az functionapp plan create --name myplan --resource-group mygroup --location westeurope --sku Dynamic

Expected behavior

Creates a consumption function app plan in azure

Environment summary Install CLI version 2.0.76

Additional context Have tried both Y1 and Dynamic and it doesn't work? Would be nice to have some examples what values it should be for the sku in the documentation also?

Author: davidstarkcab
Assignees: -
Labels:

Service Attention, Functions, customer-reported, needs-team-attention

Milestone: -

ghost avatar Mar 25 '22 05:03 ghost

@Francisco-Gamino Could you please look into this issue and provide an update once you get a chance ? Awaiting your reply.

navba-MSFT avatar Mar 25 '22 05:03 navba-MSFT

Hello @navba-MSFT -- I do not work on the Az CLI. Adding @panchagnula @gzuber who might be able to help.

Francisco-Gamino avatar Mar 25 '22 19:03 Francisco-Gamino

This seems to still be an issue. The Y1 SKU is still not an option when creating an app service plan via the Azure CLI. https://learn.microsoft.com/en-us/cli/azure/appservice/plan?view=azure-cli-latest#az-appservice-plan-create Any updates on this? @panchagnula @gzuber

julius-gummersbach avatar Mar 23 '23 11:03 julius-gummersbach

Another work around is az resource create, passing in the properties for Y1 sku.

From: http://chamindac.blogspot.com/2021/01/create-windows-or-linux-consumption.html

e.g. (replace xxxx with your business details). Works with SKU = Y1, Tier = Dynamic

$rgName = "rg-xxxx-$Environment-01".ToLowerInvariant()
$funcAspName = "asp-xxxx-$Environment-01".ToLowerInvariant()
$TagDictionary = @{ DataClassification = 'Confidential'; Criticality = $criticality;
  BusinessUnit = 'xxxx'; Env = $Environment }
$tagsJson = $TagDictionary.Keys | ForEach-Object { $key = $_; '\"'+ $key + '\":\"' + $TagDictionary[$key] + '\"' }
$funcAspProperties = '{\"kind\":\"functionapp\", ' `
  + '\"location\":\"' + $Location + '\", ' `
  + '\"sku\":{\"name\":\"' + $FuncPlanSku + '\",\"tier\":\"' + $FuncPlanTier + '\"}, ' `
  + '\"tags\":{' + [string]::Join(', ', $tagsJson) + '}' `
  + '}'

Write-Verbose "Creating with properties: $funcAspProperties"
az resource create `
  --resource-group $rgName `
  --name $funcAspName `
  --resource-type 'Microsoft.web/serverfarms' `
  --is-full-object `
  --properties $funcAspProperties

sgryphon avatar May 18 '23 00:05 sgryphon

Adding Functions Az CLI team: @amamounelsayed @shreyabatra4 @kaibocai

Francisco-Gamino avatar Jun 01 '23 16:06 Francisco-Gamino

any updates on this? Seems like a relatively easy fix and it's really annoying to have those location-based auto-generated names....

pflajszer avatar Jun 06 '23 08:06 pflajszer

Any updates on this?

linuxchata avatar Jul 17 '23 13:07 linuxchata

Please can we have an update on this? It is causing a real headache...

WiltshireKate avatar Apr 25 '24 10:04 WiltshireKate

Really need this... any updates? Given the issues with intermittent errors from v8 isolated workers this is really needed for testing app plan alternatives see https://learn.microsoft.com/en-us/answers/questions/1705006/azure-function-intermittent-error-during-cold-star

ErikAndreas avatar Jun 28 '24 10:06 ErikAndreas

it is such a shame this issue is open for FIVE years now and no one looks into it and the official documentation of microsoft is still the same

ulluoink avatar Mar 24 '25 10:03 ulluoink