I’m trying to deploy azure resources using arm templates and the azure powershell script step.
The script is defined in a package along with a template file and some parameter files like this
I would like to substitute variables in the template/parameter files, is that possible?
Thank you for getting in touch with us. You can apply variable substitution in any file you choose, using the
Substitute Variables in Files feature. We have an explanation and some examples in our documentation on Substitute Variables in Files.
I hope that helps! Let me know how it goes and if I can assist further.
Thanks for your response.
I’m aware of that feature and have used it in a
Deploy an Azure Web App step but I can’t find out how to enable it in a
Run an Azure PowerShell Script step.
Can you be of any help and guide me to where I can do that?
Ahh, that makes sense then. Unfortunately the Azure Powershell Script step doesn’t have the ability to apply substitutions, but we have a couple of other options.
The simplest solution, if your scenario supports it, is to use the built-in
Deploy Using an Azure Resource Group template. Our documentation states that “Octopus will perform variable-substitution on both the Template and Parameter files.” so this should work for you out of the box.
If that solution isn’t suitable, there is another, albeit more complicated method. You could use a
Deploy a Package step which can perform the substitution on your template and / or parameter files, and then a separate powershell script step which can locate and run the
deploy.ps1 script using the
Hopefully one of those meets your needs. Let me know what you end up with.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.