I can use azure automation runbook(powershell) to run a Powershell residing in the VM. It works well as long as there is no parameters required by the VM Powershell. If we send parameters from the runbook to VM powershell then it is not working. VM powershell recieves parameters as null. Runbook has no issues otherwise. This is how parameter is passed.
$runcmdparameters=
@{"name" = "EXE"}
Out-File -InputObject $ScriptToRun -FilePath ScriptToRun.ps1
Invoke-AzVMRunCommand -AsJob -ResourceGroupName $RG-Name -Name $myName-CommandId 'RunPowerShellScript' -ScriptPath ScriptToRun.ps1 -Parameter $runcmdparameters -Verbose
This is how the parameter is received in the VM-powershell-script
[CmdletBinding()]
param (
[Parameter(Position=0)]
[string]$name
)
