Azure Tips & Tricks - Bootstrap Automation for Existing resources for repeated deployments in multiple environments

@20aman    Jan 24, 2019

When you want to automate resource deployment you will either create the automation templates for an existing set of resources or you will create templates for resources that have not been created yet. For former situation, e.g. you have performed a Proof of Concept and now you want to automate the deployment of these set of resources.

You want to automate this because you want to deploy these resources multiple times at different times. You want to deploy these in a predictive fashion without any errors due to manual mistakes creeping in. The number of resources can be fairly large and you will actually end up saving time on the creation of these automation templates instead of manually creating everything.

Generating Automation for an existing set of resources

To generate automation for an existing set of resources, either go to the resource group or to any of the resource. Under Settings look for the option for "Automation script". Depending upon number of resources and type of resources, it may take some time to generate the template.

Note: Even though the option says "Automation script" it still generates an ARM Template for the automation.

Automation Template generation for the resources

Once the template is ready you can do the following:

  1. You can inspect the template right there on the screen.
  2. You can download the template or directly add it to your library. Once in the library, you can modify it and share it with your team. Or you can directly Deploy it by clicking on the deploy button.
  3. Look out for the errors regarding the resources that can't be exported. E.g. Key vault policies can't be exported by this wizard.
  4. Next, the Template and Parameters are shown. You can also view, Azure CLI, PowerShell, .Net or Ruby code samples to deploy the template.
  5. Make sure that you inspect the template thoroughly. Remove the resources that you don't need.
  6. Also, there will be a lot of hard-coded values in this auto-generated template. It will still be better than starting everything from scratch and doing everything manually.

Comments powered by Disqus