How to invoke powershell script in Azure Vm #20754
Unanswered
Rajkumar-21
asked this question in
Q&A
Replies: 1 comment 2 replies
-
Hey @rajkumar welcome to the discussions!
|
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In Build Yaml pipeline I'm getting vm and resource group as parameters to the task named- azurepowershell@5 and using file path mapping to powershell script where it as commands to fetch vm details and vmsize,etc.
So in next azurepowershell@5 task, I'm trying to invoke-azvmruncommand and for the argument i need to give some powershell script file where it stored in azure repo. Im getting error name/path/file are wrong like that.
As per my understanding, pipeline running on the Microsoft agent we can get info using task and script file, but when I need to invoke command, is any command is working in the vm but for mapping script file, the path must be the path of vm local not file from repo/agent Machine path.
This was I used:
Invoke-AzVMRunCommand -ResourceGroupName 'rgname' -VMName 'vmname' -CommandId 'RunPowerShellScript' -ScriptPath '$(Source.DefaultWorkingDirectory)\sample.ps1'
May i know approach to run the script file where the source of the script is azure repo and destination where the script to run is inside azure vm(Not in Microsoft agent)
Beta Was this translation helpful? Give feedback.
All reactions