未通过ARM模板设置PHP版本

时间:2020-09-14 08:37:12

标签: azure azure-web-app-service azure-resource-manager

我有一个带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')]",
        "location": "[parameters('location')]",
        "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",
                    "action": "Allow",
                    "priority": 1,
                    "name": "Allow all",
                    "description": "Allow all access"
                }
            ],
            "scmIpSecurityRestrictionsUseMain": false,
            "http20Enabled": true,
            "minTlsVersion": "1.2",
            "ftpsState": "AllAllowed",
            "reservedInstanceCount": 0
        }
    }
]

以后的编辑:关于GitHub Issue

1 个答案:

答案 0 :(得分:2)

您还应该将设置为{{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"
                    }
                ]
            },
            ...
        }
    },
...