Yogesh Kulkarni
Yogesh Kulkarni

Reputation: 359

Azure DevOps Pipeline Task error - can not find a part of the path while using Invoke-AzureRmVMRunCommand

Im trying to run the Powershell Script on Azure Windows VM using Azure DevOps release pipeline with Azure PowerShell task and Invoke-AzureRmVMRunCommand in powershell. Im using this example

Invoke-AzureRmVMRunCommand -ResourceGroupName 'rgname' -Name 'vmname' -CommandId 'RunPowerShellScript' -ScriptPath 'scriptpath' -Parameter @{"arg1" = "var1";"arg2" = "var2"}

and running this command in Azure devOps Release pipeline using Azure PowerShell Task.

Im getting the error that the path of the ScriptPath is not found. What path should we provide here.

Upvotes: 0

Views: 1447

Answers (1)

Jane Ma-MSFT
Jane Ma-MSFT

Reputation: 5222

In the script that you gave, the value of CommandId is RunPowerShellScript, which means to run a custom PowerShell script.

The value of ScriptPath represents the path to your custom PowerShell script file that needs to be executed. Its default value is none.

For more information about the Invoke-AzureRmVMRunCommand, please refer to this documentation. Here is the document's interpretation of the ScriptPath parameter:

Path of the script to be executed. When this value is given, the given script will override the default script of the command.

Upvotes: 1

Related Questions