简体   繁体   中英

How to get the time since when my Azure VM is stopped through Rest api or Java sdk

I am working on a Java application and my requirement is

1. To check if my Azure Virtual Machine is in stopped state.

2. Since when (Date/Time) it is in stopped state.

Azure Java SDK is preference but Rest API will also suffice.

You can get all the information of VM on Azure through Java sdk com.microsoft.azure.management.compute.VirtualMachine , for more details, you can reference the code Get information about the VM .

Update

Java SDK com.microsoft.azure.credentials.ApplicationTokenCredentials for vm authentication and method statuses() of SDK com.microsoft.azure.management.compute.VirtualMachineInstanceView to get vm state. If you want to get the time of stop state, you can read the time from the log.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM