首页 > 解决方案 > 无法使用 ARM 在应用服务计划上创建基于 Windows (OS) 的函数应用

问题描述

我创建了一个函数应用 ARM 模板和参数 JSON 文件,并通过 CLI 部署它。问题是,然而,我调整了模板,我总是得到一个 Linux 函数应用程序。

当我在部署后点击导出模板时,函数应用的类型会自动更改为:

  "kind": "functionapp,linux",

有什么方法可以将 Windows 操作系统功能应用程序部署到 Azure?微软根本没有记录这一点。

这是我的 ARM 模板(重要部分):

        "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
        }
    },

标签: azurearmazure-functionsazure-app-service-plans

解决方案


请完成您的 ARM 模板。然后更容易测试。保留的属性必须设置为false

解决方案应该是:

   {
    "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
    }
}

特性:


推荐阅读