0
votes

I created a resource group and various resources inside it. In Resources I have ADF & Pipelines, SQL Server, DBs & Objects, Logics Apps, AAS Models, Storage Accounts etc.

Now I want to check-in all my information into source control for versioning. I have Azure Devops as well. My need is that I want to deploy the resources and objects into another environment.

e.g I have a dev environment. I created all resources in a resource group. I did not use any template or source control while building this environment. I got Azure DevOps now. Now I want to built the test set up from the dev environment. How do I achieve this?

Any help is appreciated. Thank you.

1

1 Answers

2
votes

You can first export the Template from your Azure resource group portal. See below:

1, Go to Azure Resource Group portal-->Click Export template under Automation-->Download

enter image description here

You can also use Az cli/Azure powershell to export the template. See example commands here

Please check the documents here to learn more about how to manage your azure resource using ARM Template.

2, Sync the ARM template downloaded in above step to your azure repo.

3, Create an azure Resource Manager service connection to connect your Azure subscription to Azure devops. See this thread for an example.

4, Create an azure devops pipeline to automate the azure resource deployment.

5, Add Azure Resource Manager (ARM) Template Deployment Task in your azure pipeline to deployment the template exported in the first step.

steps:
- task: AzureResourceManagerTemplateDeployment@3
  displayName: 'ARM Template deployment: Resource Group scope'
  inputs:
    azureResourceManagerConnection: 'azuresubscriptionServiceConnection'
    subscriptionId: '......'
    resourceGroupName: 'Resource-group'
    location: 'East US'
    csmFile: template.json
    csmParametersFile: parameters.json

Above just gives you the general steps you need to take when deploying azure resources via azure devops pipeline. You need to explore the documents for yourself to learn how to customize your pipeline, how to create ARM template, And how to use the AzureResourceManagerTemplateDeployment task.