1
votes

I'm deploying Azure function into Premium Function Plan (Elastic) using Azure powershell script:

New-AzResourceGroupDeployment -ResourceGroupName $RESOURCE_GROUP -TemplateFile "function-app.json" -TemplateParameterObject $params -Name $APP_SERVICE_NAME -Mode Incremental  > $null

And deployment ignores my preWarmedInstanceCount setting. Newly created function has Always Ready Instances = 0 (see screenshot)

enter image description here

ARM template of function:

{
  "apiVersion": "2020-06-01",
  "name": "[parameters('siteName')]",
  "type": "Microsoft.Web/sites",
  "identity": {
    "type": "systemAssigned"
  },
  "kind": "functionapp",
  "location": "[resourceGroup().location]",
  "properties": {
    "name": "[parameters('siteName')]",
    "serverFarmId": "[resourceId(parameters('appServicePlanRg'),'Microsoft.Web/serverfarms',parameters('appServicePlanName'))]",
    "clientAffinityEnabled": false,
    "siteConfig": {
      "use32BitWorkerProcess": false,
      "preWarmedInstanceCount": 2,
      "appSettings": [
        {
          "name": "FUNCTIONS_EXTENSION_VERSION",
          "value": "~3"
        },
        {
          "name": "WEBSITE_CONTENTAZUREFILECONNECTIONSTRING",
          "value": "DefaultEndpointsProtocol=https;AccountName=xxx..."
        },
        {
          "name": "WEBSITE_CONTENTSHARE",
          "value": "asggas"
        }
      ]
    }
  }
}

It seems to me few days ago it did worked properly and I managed to set that value via arm template and now I can only update it via Azure portal.

Here is ARM template of my hosting plan:

{
  "type": "Microsoft.Web/serverfarms",
  "apiVersion": "2018-02-01",
  "name": "[parameters('appServicePlanName')]",
  "location": "[resourceGroup().location]",
  "properties": {
    "name": "[parameters('appServicePlanName')]",
    "workerSize": "1",
    "numberOfWorkers": "1",
    "maximumElasticWorkerCount": 20
  },
  "sku": {
    "Tier": "ElasticPremium",
    "Name": "EP2"
  }
}
2

2 Answers

2
votes

After some investigation I've come to "Activity Log" (after manual update on portal) screen and was surprised that my desired property is named as "minimumElasticInstanceCount" (it is not documented anywhere in either ARM API version https://docs.microsoft.com/en-us/azure/templates/microsoft.web/sites)

Change Log

Then I added this field to my ARM template and all looks good for now. Also some explanation and difference between "Always Ready Instances"(minimumElasticInstanceCount) and "Pre-warmed instances"(preWarmedInstanceCount) are posted here: https://docs.microsoft.com/uk-ua/azure/azure-functions/functions-premium-plan

So in Azure Portal Pre-warmed instance setting is not displayed. And I was looking for another setting.

1
votes

I have tried to replicate the issue and was able to figure out the issue here.

Instead of "preWarmedInstanceCount" try "reservedInstanceCount".

You can check from the Azure portal itself. Once you have updated the reserved instance count from the portal you can export the template :

enter image description here

Then compare your previous template with the exported one, you will be able to see the difference.