title: How to set up Azure Batch pool container configuration via ARM template?
body: <p>We are using Azure Batch, and we need to use Windows Docker containers on the VMs.</p>
  
  <p>This is how it is done via Portal:
  <a href="https://i.stack.imgur.com/lstGZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lstGZ.png" alt="containers via portal"></a></p>
  
  <p>And this is how it is done via C# API:</p>
  
  <pre class="lang-cs prettyprint-override"><code>private static VirtualMachineConfiguration ConfigureVM()
  {
      var imageNames = new List&lt;string&gt; { "microsoft/dotnet-framework:4.7" };
      var containerConfig = new ContainerConfiguration
      {
          ContainerImageNames = imageNames
      };
  
      var offer = "WindowsServer";
      var publisher = "MicrosoftWindowsServer";
      var imageSku = "2016-Datacenter-with-Containers";
      var imageReference = new ImageReference(offer, publisher, imageSku);
  
      var nodeSku = "batch.node.windows amd64";
      var vmConfig = new VirtualMachineConfiguration(imageReference, nodeSku)
      {
          ContainerConfiguration = containerConfig
      };
  
      return vmConfig;
  }
  </code></pre>
  
  <p>And now we are automating deployment so I want to do the same via ARM template (<em>this is a child resource of the Azure Batch account, so name and type are ok</em>):</p>
  
  <pre class="lang-json prettyprint-override"><code>"resources": [
      {
          "name": "Test",
          "type": "pools",
          "apiVersion": "2017-09-01",
          "properties": {
              "vmSize": "STANDARD_A1",
              "deploymentConfiguration": {
                  "virtualMachineConfiguration": {
                      "imageReference": {
                          "publisher": "MicrosoftWindowsServer",
                          "offer": "WindowsServer",
                          "sku": "2016-Datacenter-with-Containers"
                      },
                      "nodeAgentSkuId": "batch.node.windows amd64",
                      "containerConfiguration": {
                          "imageNames": [ "microsoft/dotnet-framework:4.7" ]
                      }
                  }
              }
          }
      }
  ]
  </code></pre>
  
  <p>And this does not work. When deploying, I get:</p>
  
  <pre><code>Could not find member 'containerConfiguration' on object of type 'VirtualMachineConfiguration'. 
  Path 'properties.deploymentConfiguration.virtualMachineConfiguration.containerConfiguration'
  </code></pre>
  
  <p>Without <code>containerConfiguration</code> part things work - I get VMs with docker, just without the image. I understand why this happens - the template <a href="https://docs.microsoft.com/en-us/azure/templates/microsoft.batch/batchaccounts/pools#virtualmachineconfiguration-object" rel="nofollow noreferrer">does not</a> have this property as opposed to .NET <a href="https://docs.microsoft.com/en-us/dotnet/api/microsoft.azure.batch.virtualmachineconfiguration?view=azure-dotnet#properties" rel="nofollow noreferrer">class</a>.</p>
  
  <p>So... any workaround? I guess it is not the first time when template is not synced with functionality.</p>