title: Passing parameter to script from Invoke-AzVMRunCommand
body: <p>I trying to execute the  Invoke-AzVMRunCommand to execute a PS function that accept parameters. The code below shows call to the Invoke-AzVMRunCommand</p>
  
  <pre><code>$runcmdparameters=@{
          "VolumeLable"="sdsd";
          "azurelun"="1,3,4"
                      }
  
  Invoke-AzVMRunCommand -ResourceGroupName $ServerResourceGroupName -VMName $VMVame -ScriptPath "c:\Configurestorage.ps1" -CommandId 'RunPowerShellScript' -Parameter $runcmdparameters -Verbose
  </code></pre>
  
  <p>The PS Script that I need to execute on the server is</p>
  
  <pre><code>function Configure-Storage
       {
            Param(
            [parameter(Mandatory=$true)][String]$VolumeLable,
            [parameter(Mandatory=$true)][String[]]$azurelun
            )
  
  #create a storage pool for user databases.
   Out-File "C:\Temp\log.txt" -InputObject $VolumeLable -Append
  
  }
  
  Configure-Storage -VolumeLable $VolumeLable -azurelun $azurelun
  </code></pre>
  
  <blockquote>
    <p>The script fail with Cannot bind argument to parameter 'VolumeLable'
    because it is an empty string.</p>
  </blockquote>
  
  <p>Microsoft documentation on <a href="https://docs.microsoft.com/en-us/powershell/module/az.compute/invoke-azvmruncommand?view=azps-1.2.0" rel="nofollow noreferrer">Invoke-AzVMRunCommand</a> is not very helpful. </p>
  
  <p>How can I pass the parameter to the script?</p>