How to run command in azure VM with python SDK and monitor it

Boswell Yan 21 Reputation points
2020-12-24T08:45:51.287+00:00

I want to run command in azure virtual machine with python SDK, and get status with it, if it run successfully, how to monitor it until the command terminal.

I run command to call a python file in VM and it will cost about 3 days, so I want to monitor its status. How to achieve it with python SDK?

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

1 answer

Sort by: Most helpful
  1. TravisCragg-MSFT 5,681 Reputation points Microsoft Employee
    2021-01-04T20:13:32.017+00:00

    The only way with Azure to run a command remotely on a Virtual Machine is to use the Custom Script Extension. You will need to include any monitoring & reporting within the script.

    This question is really more of a question for the OS that you are going to run the script on, and you might have more success doing this outside of the custom script extension by going to the VM directly.

    As an example, here is a Linux custom script extension in the python SDK. Depending upon the level of monitoring / reporting needed, it might be best to do this on the VM directly, or create a callback for when the command finishes.

    0 comments No comments

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.