Skip to content

Instantly share code, notes, and snippets.

@satoryu
Last active July 18, 2018 22:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save satoryu/d41b68f4c2529ea344c475c4dfd6c912 to your computer and use it in GitHub Desktop.
Save satoryu/d41b68f4c2529ea344c475c4dfd6c912 to your computer and use it in GitHub Desktop.
This template is for deploying a Web App for running PHP application whose dependencies are managed with Composer.

ARM Template to deploy new Web App for PHP application with Composer

The Azure Resource Manager template is for deploying

  • New Web App instance of PHP 7.0 under Free plan
  • Then install the site extension Composer to the Web App

Usage

Prerequisites

This instruction assumes that you already have

  • Microsoft Azure subscription
  • Azure CLI 2.0

How to deploy with the template

$ az group deployment create -g ${your_resource_group} --template-uri https://gist.githubusercontent.com/satoryu/d41b68f4c2529ea344c475c4dfd6c912/raw/4b44b694d4970240a1487c3961decdc5e73b2be6/deployWebAppForPHPwithComposer.json

That's it.

{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"appName": {
"defaultValue": "hello-php",
"type": "string"
}
},
"variables": {
},
"resources": [
{
"type": "Microsoft.Web/serverfarms",
"apiVersion": "2015-08-01",
"location": "[resourceGroup().location]",
"name": "[concat(parameters('appName'), '-free-plan')]",
"sku": {
"name": "F1"
},
"properties": {
"numberOfWorkers": 1
}
},
{
"type": "Microsoft.Web/sites",
"name": "[parameters('appName')]",
"apiVersion": "2015-08-01",
"location": "[resourceGroup().location]",
"properties": {
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', concat(parameters('appName'), '-free-plan'))]"
},
"resources" : [
{
"name": "web",
"type": "config",
"apiVersion": "2015-08-01",
"properties": {
"phpVersion": "7.0"
},
"dependsOn": [
"[resourceId('Microsoft.Web/sites', parameters('appName'))]"
]
},
{
"name": "ComposerExtension",
"type": "siteextensions",
"apiVersion": "2015-08-01",
"properties": {
"version": "0.3.3",
"feed_url": "https://www.siteextensions.net/api/v2/"
},
"dependsOn": [
"[resourceId('Microsoft.Web/sites', parameters('appName'))]"
]
}
],
"dependsOn": [
"[resourceId('Microsoft.Web/serverfarms', concat(parameters('appName'), '-free-plan'))]"
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment