0
votes

I'm trying to deploy a modified version of https://github.com/Azure/azure-quickstart-templates/blob/master/201-vmss-ubuntu-autoscale/azuredeploy.json to add in the Docker extension but am getting an error when trying to deploy. You can see how I've tried to do this at https://gist.github.com/jinky32/d80e0ab2137236ff262484193f93c946 line 329++

{
  "type": "Microsoft.Compute/virtualMachines/extensions",
  "name": "[concat(variables('vmName'),'/', variables('extensionName'))]",
  "apiVersion": "2015-05-01-preview",
  "location": "[variables('location')]",
  "dependsOn": [
    "[concat('Microsoft.Compute/virtualMachines/', variables('vmName'))]"
  ],
  "properties": {
    "publisher": "Microsoft.Azure.Extensions",
    "type": "DockerExtension",
    "typeHandlerVersion": "1.0",
    "autoUpgradeMinorVersion": true
        }
      }

when I run azure group create --name autoscalegroup2 --location "West Europe" \ --template-uri http://path/to.json

after entering a few of the details I am prompted for I get error: InvalidTemplate : Deployment template validation failed: 'The resource 'Microsoft.Compute/virtualMachines/autoscalegroup2' is not defined in the template. Please see https://aka.ms/arm-template for usage details.'.

However I thought this should work based on lines 334-336

"dependsOn": [
    "[concat('Microsoft.Compute/virtualMachines/', variables('vmName'))]"
  ],

and vmName being defined in the variables above (line 68)

"vmName": "[resourceGroup().name]",

Any help very much appreciated!

1

1 Answers

0
votes

Extensions are authored differently for VMSSs - I didn't find an exact sample (as you probably didn't) but take a look at this for an example:

https://github.com/Azure/azure-quickstart-templates/blob/master/201-vmss-ubuntu-web-ssl/azuredeploy.json#L382-L398

The properties body for the extensions are still the same for VMSS but it's not a child resource. So you'll end up with something like this in the VMSS resource properties object:

      "extensionProfile": {
        "extensions": [
          {
            "name": "docker",
            "properties": {
              "publisher": "Microsoft.Azure.Extensions",
              "type": "DockerExtension",
              "typeHandlerVersion": "1.0",
              "autoUpgradeMinorVersion": true,
              "settings": {}
            }
          }
        ]
      },

The extension profile is a peer of osProfile, networkProfile, etc