Can we use Invoke-AzVMRunCommand to run python script on azure VM.

Azure-learning 56 Reputation points
2022-10-18T16:28:42.127+00:00

Can we use Invoke-AzVMRunCommand to run python script on azure VM.

we have python 2.x script , Can we use below command which will call python script .
bash and powershell scripts are working fine for below command . just wanted to confirm if we can use python script also and if yes then please suggest the below command as per python script.

Invoke-AzVMRunCommand -ResourceGroupName "rgname" -VMName "vmname" -CommandId '' " -ScriptPath ""

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
9,013 questions
0 comments No comments
{count} votes

Accepted answer
  1. deherman-MSFT 38,021 Reputation points Microsoft Employee Moderator
    2022-10-18T19:02:48.883+00:00

    @NGaur-3476

    Run Command for Linux is designed to execute shell commands. You should be able to invoke the python script from the shell assuming its already on the VM. Please see my test below:

    251569-image.png

    You might also find this StackOverflow thread helpful as it includes a varity of methods of executing python from the shell.

    Hope this helps! Please let me know if that works for you or if you have any additional questions.

    -------------------------------

    Please don’t forget to "Accept the answer" and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.