Re-use ARM template outputs for JSON configuration feature in Azure Web App deployment step

With an ARM template deployment step it’s easy to use parameters and re-use template outputs as Octopus output variables. In the Azure Web App deployment step the json configuration feature makes it easy to do configuration transforms in appsettings.json by providing hierarchical variables named to match the json syntax but delimited with : as described here

As much as possible we are trying to treat the resource group deployments via arm templates as the source of truth for any deploy time configuration information such as connection strings, storage or app names and similar configuration details.

Is there any built in way to use the outputs from the arm template deployment step as variables for the json configuration feature step?

We’re using Octopus Deploy 3.4.10 currently.

Hi Sean,

Thanks for reaching out!

Its not possible out of the box to use output data from one ARM Template step on another one (for the json config), but you could do the following:

A) If the data is static, meaning it doesn’t get created within the first ARM template run, then you could use a single Project Variable on both the ARM template step, and the JSON config one.

B) If the data you are trying to carry to the JSON config step is something like an ID that gets generated when you run the ARM template. then you could do something like:

  • Run ARM template step.
  • Run an Azure Powershell Script to get that ID (or whatever you are trying to get) and then create an output variable with that value.
  • Use the output variable created on the Script step to transform your appsettings.json

Hope that helps. Let me know if any part doesn’t make sense.

Cheers,
Dalmiro

For our case I think option B would be more fitting, but we couldn’t find a way to use output variables to transform the variables defined in the appsettings.json. Would we just reference the output variables directly using the variable binding syntax like this?:

#{Octopus.Action[StepA].Output.TestResult}

That’s right. You’ll need to change StepA with the name of the step from where you created the variable, and TestResult with the name of the variable you created using the -name parameter of the Set-OctopusVariable cmdlet.

Thanks! We were able to get that working as described

Glad to hear that!

Cheers