"Deploy an Azure Resource Manager Template" Step Parameter Update Problem

Hi,

On the “Deploy an Azure Resource Manager Template” step page; if we change saved template, parameters which are blong to old template are not removed from the “Octopus.Action.Azure.ResourceGroupTemplateParameters” property .

Reproduce:

  1. Create and save a template
{
  "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "ServerFarm.Name": {
      "type": "string",
      "minLength": 1
    },
    "ServerFarm.SKU": {
      "type": "string",
      "allowedValues": [
        "Free",
        "Shared",
        "Basic",
        "Standard"
      ],
      "defaultValue": "Free"
    },
    "ServerFarm.WorkerSize": {
      "type": "string",
      "allowedValues": [
        "0",
        "1",
        "2"
      ],
      "defaultValue": "0"
    }
  },
  "resources": [
    {
      "name": "[parameters('ServerFarm.Name')]",
      "type": "Microsoft.Web/serverfarms",
      "location": "[resourceGroup().location]",
      "apiVersion": "2014-06-01",
      "dependsOn": [ ],
      "tags": {
        "displayName": "MyWebFarm"
      },
      "properties": {
        "name": "[parameters('ServerFarm.Name')]",
        "sku": "[parameters('ServerFarm.SKU')]",
        "workerSize": "[parameters('ServerFarm.WorkerSize')]",
        "numberOfWorkers": 1
      }
    }
  ]
}
  1. Check created step configuration
{
  "Steps": [{
    "Id": "7xxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxa",
    "Name": "Test",
    "Condition": "Success",
    "StartTrigger": "StartAfterPrevious",
    "RequiresPackagesToBeAcquired": false,
    "Actions": [{
      "Id": "exxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxe",
      "Name": "Test",
      "ActionType": "Octopus.AzureResourceGroup",
      "Environments": [],
      "Channels": [],
      "Properties": {
        "Octopus.Action.Azure.AccountId": "azureserviceprincipal-bizspark-azure-service-principal",
        "Octopus.Action.Azure.TemplateSource": "Inline",
       ** "Octopus.Action.Azure.ResourceGroupTemplateParameters": "{\"ServerFarm.SKU\":{\"value\":\"Free\"},\"ServerFarm.WorkerSize\":{\"value\":\"0\"},\"ServerFarm.Name\":{\"value\":\"TestOctopus\"}}",**
        "Octopus.Action.Azure.ResourceGroupName": "Octopus.Beta.Test",
        "Octopus.Action.Azure.ResourceGroupDeploymentMode": "Complete",
        "Octopus.Action.Azure.ResourceGroupTemplate": "{\r\n  \"$schema\": \"http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#\",\r\n  \"contentVersion\": \"1.0.0.0\",\r\n  \"parameters\": {\r\n    \"ServerFarm.Name\": {\r\n      \"type\": \"string\",\r\n      \"minLength\": 1\r\n    },\r\n    \"ServerFarm.SKU\": {\r\n      \"type\": \"string\",\r\n      \"allowedValues\": [\r\n        \"Free\",\r\n        \"Shared\",\r\n        \"Basic\",\r\n        \"Standard\"\r\n      ],\r\n      \"defaultValue\": \"Free\"\r\n    },\r\n    \"ServerFarm.WorkerSize\": {\r\n      \"type\": \"string\",\r\n      \"allowedValues\": [\r\n        \"0\",\r\n        \"1\",\r\n        \"2\"\r\n      ],\r\n      \"defaultValue\": \"0\"\r\n    }\r\n  },\r\n  \"resources\": [\r\n    {\r\n      \"name\": \"[parameters('ServerFarm.Name')]\",\r\n      \"type\": \"Microsoft.Web/serverfarms\",\r\n      \"location\": \"[resourceGroup().location]\",\r\n      \"apiVersion\": \"2014-06-01\",\r\n      \"dependsOn\": [ ],\r\n      \"tags\": {\r\n        \"displayName\": \"MyWebFarm\"\r\n      },\r\n      \"properties\": {\r\n        \"name\": \"[parameters('ServerFarm.Name')]\",\r\n        \"sku\": \"[parameters('ServerFarm.SKU')]\",\r\n        \"workerSize\": \"[parameters('ServerFarm.WorkerSize')]\",\r\n        \"numberOfWorkers\": 1\r\n      }\r\n    }\r\n  ]\r\n}\r\n"
      }
    }],
    "Properties": {}
  }]
}
  1. Edit parameters name or change the template completely
{
  "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "Octopus.Name": {
      "type": "string",
      "minLength": 1
    },
    "Octopus.SKU": {
      "type": "string",
      "allowedValues": [
        "Free",
        "Shared",
        "Basic",
        "Standard"
      ],
      "defaultValue": "Free"
    },
    "Octopus.WorkerSize": {
      "type": "string",
      "allowedValues": [
        "0",
        "1",
        "2"
      ],
      "defaultValue": "0"
    }
  },
  "resources": [
    {
      "name": "[parameters('Octopus.Name')]",
      "type": "Microsoft.Web/serverfarms",
      "location": "[resourceGroup().location]",
      "apiVersion": "2014-06-01",
      "dependsOn": [ ],
      "tags": {
        "displayName": "MyWebFarm"
      },
      "properties": {
        "name": "[parameters('Octopus.Name')]",
        "sku": "[parameters('Octopus.SKU')]",
        "workerSize": "[parameters('Octopus.WorkerSize')]",
        "numberOfWorkers": 1
      }
    }
  ]
}

  1. Check created step configuration again
{
  "Steps": [{
    "Id": "7xxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxa",
    "Name": "Test",
    "Condition": "Success",
    "StartTrigger": "StartAfterPrevious",
    "RequiresPackagesToBeAcquired": false,
    "Actions": [{
      "Id": "exxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxe",
      "Name": "Test",
      "ActionType": "Octopus.AzureResourceGroup",
      "Environments": [],
      "Channels": [],
      "Properties": {
        "Octopus.Action.Azure.AccountId": "azureserviceprincipal-bizspark-azure-service-principal",
        "Octopus.Action.Azure.TemplateSource": "Inline",
        **"Octopus.Action.Azure.ResourceGroupTemplateParameters": "{\"ServerFarm.SKU\":{\"value\":\"Free\"},\"ServerFarm.WorkerSize\":{\"value\":\"0\"},\"ServerFarm.Name\":{\"value\":\"TestOctopus\"},\"Octopus.SKU\":{\"value\":\"Free\"},\"Octopus.WorkerSize\":{\"value\":\"0\"},\"Octopus.Name\":{\"value\":\"Beta\"}}",**
        "Octopus.Action.Azure.ResourceGroupName": "Octopus.Beta.Test",
        "Octopus.Action.Azure.ResourceGroupDeploymentMode": "Complete",
        "Octopus.Action.Azure.ResourceGroupTemplate": "{\r\n  \"$schema\": \"http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#\",\r\n  \"contentVersion\": \"1.0.0.0\",\r\n  \"parameters\": {\r\n    \"Octopus.Name\": {\r\n      \"type\": \"string\",\r\n      \"minLength\": 1\r\n    },\r\n    \"Octopus.SKU\": {\r\n      \"type\": \"string\",\r\n      \"allowedValues\": [\r\n        \"Free\",\r\n        \"Shared\",\r\n        \"Basic\",\r\n        \"Standard\"\r\n      ],\r\n      \"defaultValue\": \"Free\"\r\n    },\r\n    \"Octopus.WorkerSize\": {\r\n      \"type\": \"string\",\r\n      \"allowedValues\": [\r\n        \"0\",\r\n        \"1\",\r\n        \"2\"\r\n      ],\r\n      \"defaultValue\": \"0\"\r\n    }\r\n  },\r\n  \"resources\": [\r\n    {\r\n      \"name\": \"[parameters('Octopus.Name')]\",\r\n      \"type\": \"Microsoft.Web/serverfarms\",\r\n      \"location\": \"[resourceGroup().location]\",\r\n      \"apiVersion\": \"2014-06-01\",\r\n      \"dependsOn\": [ ],\r\n      \"tags\": {\r\n        \"displayName\": \"MyWebFarm\"\r\n      },\r\n      \"properties\": {\r\n        \"name\": \"[parameters('Octopus.Name')]\",\r\n        \"sku\": \"[parameters('Octopus.SKU')]\",\r\n        \"workerSize\": \"[parameters('Octopus.WorkerSize')]\",\r\n        \"numberOfWorkers\": 1\r\n      }\r\n    }\r\n  ]\r\n}\r\n"
      }
    }],
    "Properties": {}
  }]
}

As you can notice changed parameters are stil there.

 "Octopus.Action.Azure.ResourceGroupTemplateParameters": "{\"ServerFarm.SKU\":{\"value\":\"Free\"},\"ServerFarm.WorkerSize\":{\"value\":\"0\"},\"ServerFarm.Name\":{\"value\":\"TestOctopus\"}}"

 "Octopus.Action.Azure.ResourceGroupTemplateParameters": "{\"ServerFarm.SKU\":{\"value\":\"Free\"},\"ServerFarm.WorkerSize\":{\"value\":\"0\"},\"ServerFarm.Name\":{\"value\":\"TestOctopus\"},\"Octopus.SKU\":{\"value\":\"Free\"},\"Octopus.WorkerSize\":{\"value\":\"0\"},\"Octopus.Name\":{\"value\":\"Beta\"}}"

Thanks,
Kemal

Hi Kemal,

You’re right, these should be removed from the step’s properties collection.

I have created an issue for this; we’ll get it resolved quickly.

Thanks for the feedback! It is much appreciated.

Regards,
Michael