0

I am trying to create an app service that is using PHP as it's runtime using ARM templates however the default config always leads to the creation of .Net

Example from my template:

{
      "apiVersion": "2018-11-01",
      "name": "[concat(parameters('webSiteName'),copyIndex(1))]",
      "type": "Microsoft.Web/sites",
      "location": "[resourceGroup().location]",
      "copy": {
        "name": "webloop",
        "count": 2
      },
      "identity": {
        "type": "SystemAssigned"
      },
      "dependsOn": [
        "[concat(variables('targetResourceId'),copyIndex(1))]",
        "[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName'))]"
      ],
      "tags": {
        "project": "zdemo"
      },
      "properties": {
        "name": "[concat(parameters('webSiteName'),copyIndex(1))]",
        "serverFarmId": "[concat(variables('targetResourceId'),copyIndex(1))]",
        "siteConfig": {
          "phpVersion": "7.3",
          "use32BitWorkerProcess": false,
          "connectionStrings": [
            {
              "name": "connstr",
              "connectionString": "[concat('DefaultEndpointsProtocol=https;AccountName=', parameters('storageAccountName'), ';AccountKey=', listKeys(resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName')), '2015-05-01-preview').key1,';EndpointSuffix=core.windows.net')]",
              "type": "Custom"
            }
          ]
        }
      }
    }

Here i have chosen php version however upon template deployment i see the default is to .Net

  • Hi new contributor! Have in mind that Stack Overflow is an Question/Answer base platform. I know this might seem odd or cold, but people can't help you if you don't have an precise question. Please edit your question by including some examples at least, or what you have tried, errors/warnings, desired output and/or what is the main issue. – Danilo Sep 09 '19 at 08:17
  • You can change the default config by setting the required parameter as per your need. If you are facing any specific issue while setting the required parameter, edit your question and add more details. – Anish K Sep 09 '19 at 08:23
  • code included thanks – Ziad H Hassan Sep 09 '19 at 08:23

1 Answers1

0

According to my test, you can use the following template to create a PHP web app on Azure.

template.json

{
    "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "subscriptionId": {
            "type": "string"
        },
        "name": {
            "type": "string"
        },
        "location": {
            "type": "string"
        },
        "hostingEnvironment": {
            "type": "string"
        },
        "hostingPlanName": {
            "type": "string"
        },
        "serverFarmResourceGroup": {
            "type": "string"
        },
        "alwaysOn": {
            "type": "bool"
        },
        "currentStack": {
            "type": "string"
        },
        "phpVersion": {
            "type": "string"
        }
    },
    "resources": [
        {
            "apiVersion": "2018-02-01",
            "name": "[parameters('name')]",
            "type": "Microsoft.Web/sites",
            "location": "[parameters('location')]",
            "tags": {},
            "dependsOn": [],
            "properties": {
                "name": "[parameters('name')]",
                "siteConfig": {
                    "appSettings": [],
                    "metadata": [
                        {
                            "name": "CURRENT_STACK",
                            "value": "[parameters('currentStack')]"
                        }
                    ],
                    "phpVersion": "[parameters('phpVersion')]",
                    "alwaysOn": "[parameters('alwaysOn')]"
                },
                "serverFarmId": "[concat('/subscriptions/', parameters('subscriptionId'),'/resourcegroups/', parameters('serverFarmResourceGroup'), '/providers/Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]",
                "hostingEnvironment": "[parameters('hostingEnvironment')]",
                "clientAffinityEnabled": true
            }
        }
    ]
}

parameters.json

{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "subscriptionId": {
            "value": " "
        },
        "name": {
            "value": " "
        },
        "location": {
            "value": "Southeast Asia"
        },
        "hostingEnvironment": {
            "value": ""
        },
        "hostingPlanName": {
            "value": " "
        },
        "serverFarmResourceGroup": {
            "value": " "
        },
        "alwaysOn": {
            "value": true
        },
        "currentStack": {
            "value": "php"
        },
        "phpVersion": {
            "value": "7.3"
        }
    }
}

enter image description here

enter image description here

For more details, please refer to the document.

Jim Xu
  • 21,610
  • 2
  • 19
  • 39