Skip to content

Set-AzVMRunCommand, Set-AzVmssVMRunCommand with -ScriptLocalPath parameter not working as expected #19985

Closed
@viveklingaiah

Description

@viveklingaiah

Description

Set-AzVMRunCommand, Set-AzVmssVMRunCommand with -ScriptLocalPath parameter not working as expected. They are failing due while reading the script file. Please refer to Issue script and debug output for cases that fail, only one case passes.

Issue script & Debug output

-ScriptLocalPath parameter was introduced in https://github.com/Azure/azure-powershell/issues/19468
However, it is not working as expected:

**Linux VMSS VM running .sh script fails:**
(Windows VMSS VM fails with same errors)
PS C:\Program Files (x86)\WindowsPowerShell\Modules\Az.Compute\5.1.0> Set-AzVmssVMRunCommand -ResourceGroupName VivRG0 -VMScaleSetName VivVMSSL0 -InstanceId 0 -RunCommandName MyRC -Location EastUS2EUAP -ScriptLocalPath "E:\Temp_DONOTDELETE\CountLinesInADirectory.sh"
Set-AzVmssVMRunCommand : Cannot process argument  #transformation on parameter 'SourceScript'. Cannot convert value to type System.String.
At line:1 char:1
+ Set-AzVmssVMRunCommand -ResourceGroupName VivRG0 -VMScaleSetName VivV ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Set-AzVmssVMRunCommand_ScriptLocalPath], ParameterBindingArgumentTransformationException
    + FullyQualifiedErrorId : ParameterArgumentTransformationError,Set-AzVmssVMRunCommand_ScriptLocalPath

PS C:\Program Files (x86)\WindowsPowerShell\Modules\Az.Compute\5.1.0> Set-AzVmssVMRunCommand -ResourceGroupName VivRG0 -VMScaleSetName VivVMSSL0 -InstanceId 0 -RunCommandName MyRC -Location EastUS2EUAP -ScriptLocalPath "E:\Temp_DONOTDELETE\CountLinesInADirectory.sh"
Set-AzVmssVMRunCommand : Cannot process argument transformation on parameter 'SourceScript'. Cannot convert value to type System.String.
At line:1 char:1
+ Set-AzVmssVMRunCommand -ResourceGroupName VivRG0 -VMScaleSetName VivV ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Set-AzVmssVMRunCommand_ScriptLocalPath], ParameterBindingArgumentTransformationException
    + FullyQualifiedErrorId : ParameterArgumentTransformationError,Set-AzVmssVMRunCommand_ScriptLocalPath

**Linux  VM running .sh script fails:**
PS C:\Program Files (x86)\WindowsPowerShell\Modules\Az.Compute\5.1.0> Set-AzVMRunCommand -ResourceGroupName VivRG0 -VMName VivL1 -RunCommandName MyRC -Location EastUS2EUAP -ScriptLocalPath "E:\Temp_DONOTDELETE\CountLinesInADirectory.sh"
Set-AzVMRunCommand : Cannot process argument transformation on parameter 'SourceScript'. Cannot convert value to type System.String.
At line:1 char:1
+ Set-AzVMRunCommand -ResourceGroupName VivRG0 -VMName VivL1 -RunComman ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Set-AzVMRunCommand_ScriptLocalPath], ParameterBindingArgumentTransformationException
    + FullyQualifiedErrorId : ParameterArgumentTransformationError,Set-AzVMRunCommand_ScriptLocalPath




The only case it works is for Windows VM running .ps1 file:
PS C:\Program Files (x86)\WindowsPowerShell\Modules\Az.Compute\5.1.0> Set-AzVMRunCommand -ResourceGroupName VivRG0 -VMName VivEE -RunCommandName MyRC -Location EastUS2EUAP -ScriptLocalPath "E:\Temp_DONOTDELETE\HelloWorldFileCreation.ps1"

Location    Name
--------    ----
EastUS2EUAP MyRC

Environment data

NA

Module versions

Az.Compute module version 5.1.0

Error output

No response

Metadata

Metadata

Assignees

Labels

ComputeService AttentionThis issue is responsible by Azure service team.bugThis issue requires a change to an existing behavior in the product in order to be resolved.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions