title: Azure ARM Template dependsOn: How to reference a VM extension?
body: <p>I have an Azure ARM Teamplate that should create a Linux VM with Docker. Docker is installed using Azure's <code>DockerExtension</code>. After Docker is installed, I need to run a custom script using Azure's <code>CustomScriptForLinux</code>. Therefore, the second script should depend on the Docker installation. Here is an example that shows how I tried to write that in an ARM template:</p>
  
  <pre><code>{
    ...,
    "variables": {
      "extensionName": "DockerExtension",
      "vmName": "Docker",
      ...
    },
    "resources": [
      ...,
      {
        "type": "Microsoft.Compute/virtualMachines/extensions",
        "name": "[concat(variables('vmName'), '/', variables('extensionName'))]",
        "tags": {
          "displayName": "DockerExtension"
        },
        "apiVersion": "2015-06-15",
        "location": "[resourceGroup().location]",
        "dependsOn": [
          "[concat('Microsoft.Compute/virtualMachines/', variables('vmName'))]"
        ],
        "properties": {
          "publisher": "Microsoft.Azure.Extensions",
          "type": "DockerExtension",
          "typeHandlerVersion": "1.1",
          "autoUpgradeMinorVersion": true,
          "settings": { }
        }
      },
      {
        "type": "Microsoft.Compute/virtualMachines/extensions",
        "name": "[concat(variables('vmName'), '/config')]",
        "apiVersion": "2015-06-15",
        "location": "[resourceGroup().location]",
        "dependsOn": [
          "[concat('Microsoft.Compute/virtualMachines/extensions/', variables('vmName'), '/', variables('extensionName'))]"
        ],
        "properties": {
          "publisher": "Microsoft.OSTCExtensions",
          "type": "CustomScriptForLinux",
          "typeHandlerVersion": "1.4",
          "settings": {
            "fileUris": [
              "..."
            ],
            "commandToExecute": "bash configure.sh"
          }
        }
      }
    ]
  }
  </code></pre>
  
  <p>If I run this ARM template, I get the error <code>The resource 
  'Microsoft.Compute/virtualMachines/extensions/Docker/DockerExtension' is not defined in the template.</code> I don't understand why. This is the name of the Docker extension I have in my template, isn't it?</p>
  
  <p>The template works if I run just one of the scripts. So there should not be a general error in the template.</p>
  
  <p>Any help appreciated.</p>
  
  <p>Regards,
  Rainer.</p>