0
votes

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.

1

1 Answers

0
votes

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.