Variable substitution not occurring after pre-deployment script

Good afternoon,

I’m attempting to deploy an API to Azure API Management through an ARM template. To achieve this, I am using the Deploy an Azure Resource Manager template step.

The template is very simple, with just one apis resource, and I’m attempting to reference a swagger document for API configuration. However, the template parameter swaggerBlobUrl is not being substituted as I expect. It may be that my understanding of how I can do this is wrong.

To populate the Octopus parameter swaggerBlobUrl, I’m running a pre-deployment script and outputting the value to $OctopusParameters[“swaggerBlobUrl”]. My understanding from the docs is that pre-deployment scripts run before variable substitution, so I was expecting this to work.

Please find below snippets from my ARM template and the associated parameters file.

Resource from ARM template

"resources": [
        "type": "Microsoft.ApiManagement/service/apis",
        "name": "[concat(parameters('apiManagementServiceName'), '/', parameters('apiName'))]",
        "apiVersion": "2018-01-01",
        "properties": {
            "path": "[parameters('apiPath')]",
            "contentFormat": "swagger-link-json",
            "contentValue": "[parameters('swaggerBlobUrl')]"

Parameter declaration

"swaggerBlobUrl": {
    "value": "#{swaggerBlobUrl}"

Please disregard this question - no sooner than I stop looking do I find the solution!

Set-OctopusVariable -name "swaggerBlobUrl" -value $swaggerBlobUrl

Hi David,

Thanks for getting in touch and letting us know you’ve found the solution! Please don’t hesitate to reach out if you have any questions or concerns in the future. :slight_smile:

Best regards,


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.