How to create or adjust the Environment after Azure Resource Manager provisioned resources?

I was pleasantly surprised to learn that Octopus directly supports Azure Resource Manager Template deployment as a native step. It allows to provision necessary resources (for instance, virtual machines) as part of the deployment process and get back specifics (like machine names or addresses) of the newly created infrastructure.

My question is - how to create or adjust Octopus Environment and the rest of the deployment process to match what was just created? For instance, ARM Template provisioned some new VMs for different roles. How to make those VMs part of the target Environment or otherwise make deployment process aware of them?

Hi Konstantine,

Thanks for getting in touch. I think the core of what you’re after is detailed in our Elastic and transient environments documentation. In short, if you add a Health check step in after the steps that create the infrastructure and select the Include new deployment targets in the deployment option then the new targets will be available during the subsequent steps.

This is based on the assumption that you are deploying VMs that have a Tentacle, either manually or using the Octopus VM extension, and have them registering with the Octopus server. Once they are registered the Health check will be able to pick them up.

Hope that helps and if I can assist further just let me know.

Regards
Shannon

Shannon, thank you for your answer! I have read the documentation you referred me to, but still exact process evades me. For instance, ARM Template deployment step instantiated new VM and we can get back some data about that new VM (like the name) through the template output properties. We can use Octopus VM extension to make sure new VM has Octopus Tentacle installed. Now we are back to Octopus deployment script.

How do we make that new VM part of particular Octopus Environment and how we assign specific roles to it? Is there example Octopus script?

I understand Health Check can discover new deployment targets, but how does it know 1. Which (new) machines to check? 2. Which Enironment(s) they should belong to and 3. Which roles they supposed to fulfill?

Hi Konstantine,

Depending on exactly how you’re deploying the VM, the technique is slightly different. If you’ve manually deployed the Tentacle then you need to do something like this from the command line. For the VM extensions, there’s some information here.

Whichever of those you end up using, the idea is they register the new target (machine) with the server, and can provide the environment(s) and role(s) it should be assigned. So for the command line example, you could add a script step after the VM create step, and then put the Health Check step after that. The Health Check will scope to any targets (machines) in the Environment that the release is being deployed to.

Shannon

Shannon, thank you very much! Your second link answers my question completely.

Konstantin