You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用ARM模板部署Windows版Azure Function App异常问题咨询

问题原因

你部署得到的始终是Linux版本Function App,核心原因是绑定的App Service Plan被配置为Linux专用模式,修改对应配置即可部署Windows版本的Function App。

需要修改的配置

  • 核心修改:调整App Service Plan(Microsoft.Web/serverfarms资源)的properties.reserved属性,将当前值true改为false。Azure App Service Plan中reserved属性为true代表该计划预留给Linux资源使用,会强制所有绑定到该计划的应用使用Linux系统,修改为false即可切换为Windows模式。
  • 可选优化:在Function App(Microsoft.Web/sites资源)的siteConfig中明确添加"netFrameworkVersion": "v4.0",避免运行时自动适配异常。
  • 注意:如果之前已经部署过Linux版本的App Service Plan,建议删除原有资源后再用修改后的模板重新部署,避免资源属性更新残留导致的异常。

修改后的核心模板片段

App Service Plan配置

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

Function App配置

{
    "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": {
            "netFrameworkVersion": "v4.0",
            "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'))]"
    }
}

内容的提问来源于stack exchange,提问作者Benjy Bret Barlow

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.30 01:24:03