0
votes

I working on Azure ARM templates, I developed few ARM templates for production environment it includes vnet, subnet, web app, API app, storage and database etc...

I had the source code contains the MVC application and Azure API Application and check in the code into VSTS team repository.

Source code managed in VS2017:

enter image description here

Currently I created Build and Release for source code along with ARM templates in single build and release by following this link.

I have few questions in my mind after implemented above process in my current environment:

  1. What are best industry practices to manage the source code and ARM templates in VS2017?

  2. How to know which version of ARM template deployed in specified resource group?

  3. For suppose if someone changes the application code only, then also ARM template deployed along with modified source code into azure. is it recommended approach?

  4. Is it recommended approach for deploying the source code along with ARM templates at time by creating single build and release definition In VSTS?

  5. Is it recommended way to give application settings and connection strings in web app and API app arm templates?

  6. What is the enterprise implementations to deploy the ARM templates and source code into azure environment using VSTS?

1
This question is way too broad. Do you have a specific problem you're encountering that you need help solving?Daniel Mann
Regarding second question, do you mean different version of that ARM template will be deployed to different resource groups? How do you identify which version should deploy to the specified resource group?starian chen-MSFT
Still now I didn't use version parameter in my ARM Templates.Can you please suggest me, how to include the version parameter in ARM TemplatesMani

1 Answers

0
votes

You can deploy ARM and web application in the same build/release, simple workflow:

  1. Check the template file has been updated or not through VSTS REST API (e.g. Get a single commit with changed items)
  2. Check the related resource is existing in Azure through Azure PowerShell task (e.g. Find-AzureRmResource, Get-AzureRmResource)
  3. Add a new variable per to the results of step1 and step3 through Logging Command (e.g. isUpdated: Write-Host "##vso[task.setvariable variable= isUpdated;]true")
  4. Add Azure Resource Group Deployment task and choose custom conditions in Run this taks box (Custom condition: eq(variables[isUpdated '], 'true')
  5. Add corresponding tasks to deploy your web app.