Reputation: 1620
Here's a sample scenario:
How do I provide the third task with the output of the first task? Is there another way to approach this?
Upvotes: 3
Views: 749
Reputation: 8737
Paul another way you could accomplish this is by doing all 3 in your first task (Azure PowerShell) - you could also combine 1 and 3 and leave 2 separate, either should work for you using the stock "tasks" in VSTS.
So the first step in your workflow about can create the web app (et al), update the configuration and deploy the webapp. If deploying the webapp in the template isn't desirable, you can combine step 1 & 3 in your workflow and do site deployment separately. Take a look at these examples, combined they do what you want (I couldn't find a single example quickly):
https://github.com/davidebbo/AzureWebsitesSamples/blob/master/ARMTemplates/WebAppDeployment.json (this shows how to do app configuration)
You can reference your storage keys in the same deployment that creates the storage account see: https://github.com/rjmax/ArmExamples/blob/fa4359bd393692bbb07b4460636c5b754191e42d/listKeysSample.json)
https://github.com/davidebbo/AzureWebsitesSamples/blob/master/ARMTemplates/WordpressTemplateWebDeployDependency.json (this shows how to do webdeploy in the template)
Upvotes: 1
Reputation: 176
You can use task logging commands in VSTS to "output" variables from one task and read them in the other. The first Azure PS task in your example could log an output variable that can later be read in the last one. See https://github.com/Microsoft/vso-agent-tasks/blob/master/docs/authoring/commands.md for format of these logging commands.
Upvotes: 3
Reputation: 12228
It is possible to 'chain' ARM templates together via the 'output' section to share state from one template to another.
So you can specify an output from one template, and either pick that output up via the Powershell script that calls it, or you can chain the templates together so they all run from a single New-AzureRmResourceGroupDeployment call. With the template for the Web app configuration task directly picking up the output of the deployment template.
There is some good documentation here - Sharing state in Azure Resource Manager templates
Upvotes: 0