title: Cannot pass an array type parameter in ARM template via Powershell
body: <p>I have an ARM Template with the following parameters:</p>
  
  <pre><code>"parameters": {
      "projectName": {
        "type": "string",
        "metadata": {
          "description": "Name of the project"
        }
      },
      "environmentName": {
        "type": "string",
        "defaultValue": "testing",
        "metadata": {
          "description": "Name/Type of the environment"
        }
      },
      "vmResourceGroupName": {
        "type": "string",
        "metadata": {
          "description": "Resource Group in which VMs wil be deployed"
        }
      },
      "vmName": {
        "type": "string",
        "metadata": {
          "description": "Name of the Virtual Machine"
        }
      },
      "vmIPAddress": {
        "type": "string",
        "metadata": {
          "description": "IP Address of the Virtual Machine"
        }
      },
      "osDiskVhdUri": {
        "type": "string",
        "metadata": {
          "description": "Uri of the existing VHD in ARM standard or premium storage"
        }
      },
      "dataDiskVhdUri": {
        "type": "array",
        "metadata": {
          "description": "Uri of the existing VHD in ARM standard or premium storage"
        }
      },
      "vmSize": {
        "type": "string",
        "metadata": {
          "description": "Size of the Virtual Machine"
        }
      },
      "osType": {
        "type": "string",
        "allowedValues": [
          "Windows",
          "Linux"
        ],
        "metadata": {
          "description": "OS of the VM - Typically Windows or Linux"
        }
      },
      "ManagedDisk": {
        "type": "string",
        "allowedValues": [
          "Yes",
          "No"
        ],
        "metadata": {
          "description":  "Yes for Managed Disks, No for VHDs"
        }
      }
  </code></pre>
  
  <p>As evident, $dataDiskVHDURI is of type:array and I am trying to deploy the template using <strong>-TemplateParameterObject</strong> with <strong>New-AzureRMresourceGroupDeployment</strong> cmdlet in Powershell using the following code:</p>
  
  <pre><code>{
          $vmWithDDTemplate = 'azuredeploy.json'
      $vmWithoutDDTemplate = 'azuredeploy-withoutdd.json'
  
      $dataDiskVhdUri = New-Object -TypeName System.Collections.ArrayList
      $dataDiskVhdUri.Add("$VM.dataDiskVhduri")
  
  
      #Creating VM param object    
      $VMTemplateObject = @{"projectname" = $projectName; `  
                            "environmentname" = $environmentName; `
                            "vmResourceGroupName" = $vmResourceGroupName; `
                            "vmName" = $VM.vmName; `
                            "vmIPAddress" = $VM.vmIPAddress; `
                            "osDiskVhdUri" = $VM.osDiskVhdUri; `
                            "dataDiskVhdUri" = ,$dataDiskVhdUri; `
                            "vmSize" = $VM.vmSize; `
                            "osType" = $VM.osType; `
                            "ManagedDisk" = $VM.ManagedDisk
                           }
      #$VMTemplateObject
  
      # Checking if VM contains a data disk
      if($VM.dataDiskVhdUri -ne $null) 
      {
          Write Output "$VM contains data disk"
  
          New-AzureRmResourceGroupDeployment -Name ('vmwithdd' + '-' + ((Get-Date).ToUniversalTime()).ToString('MMdd-HHmm')) `
                                     -ResourceGroupName $ResourceGroupName `
                                     -TemplateParameterObject $VMTemplateObject `
                                     -TemplateFile $vmWithDDTemplate `
                                      -Force -Verbose -ErrorVariable ErrorMessages `
                                      -ErrorAction Stop -DefaultProfile $azureCred
  
      }
      else
      {
          Write-output '$VM does not contain data disk'
      }
  }
  </code></pre>
  
  <p>However, I get the following error every time:</p>
  
  <blockquote>
    <p>Microsoft.PowerShell.Utility\Write-Error : 4:46:14 PM - Error:
    Code=InvalidTemplate; Message=Deployment template validation  failed:
    'The provided value for the template parameter 'dataDiskVhdUri' at
    line '44' and column '27' is not valid.'. At Create-Environment:73
    char:73
    + 
        + CategoryInfo          : NotSpecified: (:) [Write-Error], RemoteException
        + FullyQualifiedErrorId : System.Management.Automation.RemoteException,Microsoft.PowerShell.Commands.WriteErrorCommand
        + PSComputerName        : [localhost]</p>
  </blockquote>
  
  <p>Does anyone know how to resolve this?</p>