title: How to pass multiple parameters in a function in Powershell?
body: <p>I am trying to run a Powershell script for a runbook in an automation account in Azure. I am using a function to pass multiple parameters. The runbook is for restoring disks of VM. However from the code structure that I am using it doesn't seem like I can pass in more than 1 Resource Name. How do I restructure this code or how do I frame my function or anyone of the lines in the script in order to pass more than one Resource Name (VM names in this case) ?</p>
  
  <p>Currently I can pass only one Resource Name in the function but I need to pass two VM names. </p>
  
  <pre><code>function DiskRestore($ResourceName, $storageAccount)
  {
  
   try
   {
    .....
    .....
    .....
         $resources = Get-AzureRmResource -ResourceGroupName"samplerg" -ResourceName  $ResourceName
  
    .....
    .....
    .....
         $restorejob = Restore-AzureRmRecoveryServicesBackupItem -RecoveryPoint $rp[0] -StorageAccountName $storageAccount -StorageAccountResourceGroupName "samplerg"
  
    .....
    .....
    .....
    }
    }
  
    DiskRestore -ResourceName "samplevm01" -storageAccount "samplesa01"
  </code></pre>
  
  <p>So in the above function how can I pass one more VM name apart from samplevm01. How can I pass samplevm02 ? The storage account remains the same. Thanks in advance. </p>