Imagine I have two Virtual Machines in my Azure subscription. From machine Foo, I’d like to be able to run Powershell commands and scripts on Bar under an admin account.
I will be using a Continuous Build Server on Foo, that when triggered it will create a (signed) script called go.ps1 in a shared directory accessible by both Foo and Bar. After that script is created, I want my CBS to have Bar copy that file to C:\scripts\go.ps1
and execute it, as if I were an Admin sitting at Bar. I’ve done something similar in the past on physical machines using psexec. I assume there is something similar for Azure VMs.
invoke-command
to execute remote script or .ps1 file. – Ivan Yang