Deploy Azure Web App with Git deployment using Resource Manager (ARM) Template

1.7k Views Asked by At

This example shows how to create a Web App that is linked to a GitHub repo via Azure Resource Manager (ARM) template: https://github.com/Azure/azure-quickstart-templates/tree/master/201-web-app-github-deploy

Here's the snippet of the dependent resource:

    {
      "apiVersion": "2015-04-01",
      "name": "web",
      "type": "sourcecontrols",
      "dependsOn": [
        "[resourceId('Microsoft.Web/Sites', parameters('siteName'))]"
      ],
      "properties": {
        "RepoUrl": "[parameters('repoURL')]",
        "branch": "[parameters('branch')]",
        "IsManualIntegration": true
      }
    }

However, I want to create a website where I deploy from my own, local git repo. How can this be done with an ARM template?

UPDATE: To clarify what I am looking to do: I want to create a Web App that has an attached Git repo. See this article: https://azure.microsoft.com/en-us/documentation/articles/web-sites-publish-source-control/ -- The step I am trying to automate is described in the section headed "Enable the web app repository" -- I don't want to have to do it through the Azure portal

2

There are 2 best solutions below

3
On BEST ANSWER

I was able to find the right settings for the ARM template JSON by browsing: https://resources.azure.com

Here is the snippet...

  "resources": [
    {
      "apiVersion": "2015-08-01",
      "name": "web",
      "type": "config",
      "dependsOn": [
        "[resourceId('Microsoft.Web/Sites/', variables('siteName'))]"
      ],
      "properties": {
        "phpVersion": " ",
        "scmType":  "LocalGit"
      }
    }
  ]

The solve was to add "scmType" key with value of "LocalGit".

1
On

A Git repo does not, in itself do anything other than to just save versions of your code and scripts.

However, if you hook this up to a build system, such as Visual Studio Team Services (free = nice!) you can have the build system both compile your website, and then execute your ARM template, through release management in order to provision a clean/fresh environment.