I am looking for a way to get the power state of a VM through the Azure ARM API (more specifically with the Java SDK), so far without any luck.
The code which retrieves the VM is the following:
import com.microsoft.azure.management.compute.ComputeManagementService;
import com.microsoft.azure.management.compute.ComputeManagementClient;
import com.microsoft.azure.management.compute.models.VirtualMachineGetResponse;
import com.microsoft.azure.management.compute.models.VirtualMachine;
@Test
public void getVirtualMachine() throws Exception {
ComputeManagementClient client = ComputeManagementService.create(createConfiguration());
VirtualMachineGetResponse response = client.getVirtualMachinesOperations().get("vdimtest5rg", "vdim-test-5");
VirtualMachine virtualMachine = response.getVirtualMachine();
}
The REST call to which this results is:
GET /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{virtualMachineName}?api-version=2015-06-15
What is the recommended way to get the power state of a virtual machine in Azure through ARM?
I don't mind using a plain HTTP request, as long as I don't have to fall back to the ASM API and authenticate with a client certificate.