Trending on MSDN: Check if an Azure VM is up and Running

Micah McKittrick 962 Reputation points Microsoft Employee Moderator
2019-10-29T19:30:55.847+00:00

I want to start a Virtual Machine using REST API.

I am currently following this code.

I have 3 questions:

  1. Is there a way to know if a VM is up and running already using API or any other code?
  2. What will happen if I try to start a Virtual Machine that is already running?
  3. How can we find out after calling the API that the VM is actually up and running? Is there a fixed wait time?

Sourced from MSDN

Azure Database for MySQL
0 comments No comments

Answer accepted by question author
olufemia-MSFT 2,866 Reputation points
2019-10-29T22:58:25.23+00:00

Welcome to the Microsoft Q&A (Preview) platform. Happy to answer your questions.

All the REST commands related to Virtual Machines can be found here.

The instance view Command will get you the status of the VM to see if it is running or deallocated.

If you attempt to start a virtual machine that is already in the running state, the command will simply error out stating the VM is already running. It will not impact the VM negatively in any way. Here is the API command to start a VM.

An example in PowerShell after running the start command is that you get a response back stating that the VM is up and running that the command was successful. The same is true for a REST call. And as mentioned above, you can always use the instance view call to get the current power status of a VM.

Sourced from MSDN

Was this answer helpful?

2 people found this answer helpful.
0 comments No comments

2 additional answers

Sort by: Newest
  1. 2022-05-30T04:15:43.917+00:00

    thank you so much for this answer ITS REALLY helpful

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments

  2. Staphanie Morer 6 Reputation points
    2021-01-28T05:58:14.523+00:00

    thank you so much for this answer ITS REALLY helpful

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments

Your answer

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