未通过ARM模板设置PHP版本

问题描述

我有一个带Web配置的Web应用程序的ARM模板,如下所示。我想将Stack设置为PHP,将版本设置为7.4,如在Portal中所见,但在部署时未设置。我想念什么。

所需的配置:

enter image description here

结果:

enter image description here

模板:

    "resources": [
    {
        "apiVersion": "2019-08-01","type": "Microsoft.Web/serverfarms","name": "[variables('appServicePlanPortalName')]","location": "[parameters('location')]","kind": "app","sku": {
            "name": "[parameters('sku')]"
        }
    },{
        "apiVersion": "2020-06-01","type": "Microsoft.Web/sites","name": "[parameters('webAppNameLegacy')]","dependsOn": [
            "[resourceId('Microsoft.Web/serverfarms',variables('appServicePlanPortalName'))]"
        ],"properties": {
            "serverFarmId": "[resourceId('Microsoft.Web/serverfarms',variables('appServicePlanPortalName'))]","reserved": false,"isXenon": false,"hyperV": false,"siteConfig": {},"scmSitealsoStopped": false,"clientAffinityEnabled": true,"clientCertEnabled": false,"hostNamesdisabled": false,"containerSize": 0,"dailyMemoryTimeQuota": 0,"httpsOnly": false,"redundancyMode": "None"
        }
    },{
        "apiVersion": "2018-11-01","type": "Microsoft.Web/sites/config","name": "[concat(parameters('webAppNameLegacy'),'/web')]","location": "West Europe","dependsOn": [
            "[resourceId('Microsoft.Web/sites',parameters('webAppNameLegacy'))]"
        ],"properties": {
            "numberOfWorkers": 1,"defaultDocuments": [
                "Default.htm","Default.html","Default.asp","index.htm","index.html","iisstart.htm","default.aspx","index.PHP"
            ],"PHPVersion": "7.4","requestTracingEnabled": false,"remoteDebuggingEnabled": false,"remoteDebuggingVersion": "VS2019","httpLoggingEnabled": false,"logsDirectorySizeLimit": 35,"detailedErrorLoggingEnabled": false,"azureStorageAccounts": {},"scmType": "None","webSocketsEnabled": true,"managedPipelineMode": "Integrated","virtualApplications": [
                {
                    "virtualPath": "/","physicalPath": "site\\wwwroot","preloadEnabled": true
                }
            ],"loadBalancing": "LeastRequests","experiments": {
                "rampupRules": []
            },"autoHealEnabled": false,"localMysqLEnabled": false,"ipSecurityRestrictions": [
                {
                    "ipAddress": "Any","action": "Allow","priority": 1,"name": "Allow all","description": "Allow all access"
                }
            ],"scmIpSecurityRestrictions": [
                {
                    "ipAddress": "Any","scmIpSecurityRestrictionsUseMain": false,"http20Enabled": true,"minTlsversion": "1.2","ftpsstate": "AllAllowed","reservedInstanceCount": 0
        }
    }
]

以后的编辑:关于GitHub Issue

解决方法

您还应该将设置为{{1}的CURRENT_STACK参数作为ARM模板中php siteconfig属性的一部分传递。

metadata

以下是用于使用PHP 7.4作为运行时堆栈创建Web应用程序的完整模板:

...
    {
        "type": "Microsoft.Web/sites","apiVersion": "2018-11-01","name": "[parameters('sites_app_name')]","location": "Central US","kind": "app","properties": {
            ...
            "siteConfig": {
                "metadata": [
                    {
                        "name": "CURRENT_STACK","value": "php"
                    }
                ]
            },...
        }
    },...