Home > Back-end >  Cannot create Windows (OS) based Function App on App Service Plan using ARM
Cannot create Windows (OS) based Function App on App Service Plan using ARM

Time:10-21

I created a function app ARM template and parameters JSON files and deployed it via the CLI. The problem is that however, I adjust the template, I always end up with a Linux Function App.

When I hit Export Template after deployment, the kind of the function app automatically changes to:

  "kind": "functionapp,linux",

Is there any way I can deploy a Windows OS function app to Azure? This is not documented at all by Microsoft.

Here's my ARM template (the important part):

        "type": "Microsoft.Web/sites",
        "apiVersion": "2018-11-01",
        "name": "[parameters('name')]",
        "location": "[parameters('location')]",
        "dependsOn": [
            "[resourceId('Microsoft.Web/serverfarms', parameters('app_serviceplan_name'))]",
            "[resourceId('Microsoft.Storage/storageAccounts', parameters('storage_account_name'))]"
        ],
        "tags": {},
        "kind": "functionapp",
        "identity": {
            "type": "SystemAssigned"
        },
        "properties": {
            "name": "[parameters('name')]",
            "siteConfig": {
                "appSettings": [
                    {
                        "name": "FUNCTIONS_WORKER_RUNTIME",
                        "value": "node"
                    },
                    {
                        "name": "FUNCTIONS_EXTENSION_VERSION",
                        "value": "~3"
                    },
                    {
                        "name": "WEBSITE_NODE_DEFAULT_VERSION",
                        "value": "~14"
                    },
                    {
                        "name": "APPINSIGHTS_INSTRUMENTATIONKEY",
                        "value": "[BLANK_HERE_FOR_SECURITY_PURPOSES]"
                    },
                    {
                        "name": "AzureWebJobsStorage",
                        "value": "[concat('BLANK_HERE_FOR_SECURITY_PURPOSES')]"
                    }
                ]
            },
            "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('app_serviceplan_name'))]",


    {
        "type": "Microsoft.Web/serverfarms",
        "apiVersion": "2018-02-01",
        "name": "[parameters('app_serviceplan_name')]",
        "location": "[parameters('location')]",
        "sku": {
            "name": "EP1",
            "tier": "ElasticPremium",
            "size": "EP1",
            "family": "EP",
            "capacity": 1
        },
        "kind": "elastic",
        "properties": {
            "perSiteScaling": false,
            "maximumElasticWorkerCount": 20,
            "isSpot": false,
            "reserved": true,
            "isXenon": false,
            "hyperV": false,
            "targetWorkerCount": 0,
            "targetWorkerSizeId": 0
        }
    },

CodePudding user response:

Please complete your ARM template. Then it is easier to test. The property reserved must be set to false.

The solution should be:

   {
    "type": "Microsoft.Web/serverfarms",
    "apiVersion": "2018-02-01",
    "name": "[parameters('app_serviceplan_name')]",
    "location": "[parameters('location')]",
    "sku": {
        "name": "EP1",
        "tier": "ElasticPremium",
        "size": "EP1",
        "family": "EP",
        "capacity": 1
    },
    "kind": "elastic",
    "properties": {
        "perSiteScaling": false,
        "maximumElasticWorkerCount": 20,
        "isSpot": false,
        "reserved": false,
        "isXenon": false,
        "hyperV": false,
        "targetWorkerCount": 0,
        "targetWorkerSizeId": 0
    }
}

Properties:

  • enter image description here
  • Related