How to deploy to Azure Resource Group using VSTS release management
<p>I am new to Visual Studio Team Services Release Management. My goal is to automate a deployment of an ASP.NET MVC application to the Azure App Service.</p>

<p>Trying different approaches, I created a Service Endpoint that is certificate based and one that uses a service principal (SPN). My build definition already builds a web deploy package, and the release definition is linked against that and can use this artifact.</p>

<p><strong>Success 1:</strong>
A deployment of the app using the <em>Azure Web App Deployment</em> Task already succeeded - almost.<br>
<strong>Shortcoming 1:</strong> I do not understand how I can specify the correct Resource Group using this task. This uses the certificate based endpoint, and for this task I cannot use the other (SPN) endpoint.</p>

<p><strong>Success 2:</strong>
Using the <em>Azure Resource Group Deployment</em> task, I was able to use a JSON ARM template to create a new resource group with a web app in it. This way I can specify the resource group, addressing <em>Shortcoming 1</em><br>
<strong>Shortcoming 2:</strong> But now I don't understand how I can actually deploy the binaries of the build definition that has been linked against my release definition. The web application that gets created by the resource group deployment is empty, and a subsequent Web App Deployment Task seemingly cannot target this newly created web app, since it is probably not ARM based.</p>

<p>I get the feeling that I am missing something obvious here - any help is appreciated.</p>

<h1>Update 1</h1>

<p>Thanks to @bmoore-msft, I got a deployment working using the child resource extension example he linked to. Essentially, the corresponding snippet of my ARM template now looks like this:</p>

<pre><code>"resources": [
{
    "apiVersion": "2015-08-01",
    "type": "Microsoft.Web/sites",
    "name": "[variables('fullEnvName')]",
    "location": "[parameters('siteLocation')]",
    "properties": {
        "name": "[variables('fullEnvName')]"
    },
    "resources": [
        {
            "apiVersion": "2014-06-01",
            "name": "MSDeploy",
            "type": "Extensions",
            "dependsOn": [
                "[concat('Microsoft.Web/Sites/', variables('fullEnvName'))]"
            ],
            "properties": {
                "packageUri": "https://dl.dropboxusercontent.com/u/&lt;myId&gt;/&lt;WebDeploymentPackage&gt;.zip",
                "dbType": "None",
                "connectionString": "",
                "mode": "Complete"
            }
        }
    ]
  }
]
</code></pre>

<p>But the problem is that this places a static link into my template - as you can see, I used Dropbox as temporary solution. But of course I don't want to upload my web deployment package to Dropbox, neither manually nor automatically. I want to link to the artifact created by my build definition, which unfortunately is dynamic and I can't find any information on how to construct this link. For example, build 1 is located at the following path<br>
<code>https://&lt;tenant&gt;.visualstudio.com/DefaultCollection/_apis/resources/Containers/800850?itemPath=&lt;PathToWebDeploymentPackage&gt;.zip</code><br>
while build 2 is available here<br>
<code>https://&lt;tenant&gt;.visualstudio.com/DefaultCollection/_apis/resources/Containers/801968?itemPath=&lt;PathToWebDeploymentPackage&gt;.zip</code></p>

<p>So there is a number changing inside the link which means the link I refer to in my template must be dynamic which means I need to understand where to get that number from, which I don't.</p>

<p>Maybe there is another way of referencing artifact uploads? </p>