For system, network and cloud administrators

How to verify if an Azure virtual machine has stopped using Azure CLI

In order to verify an Azure virtual machine’s power state, you can use:

az vm get-instance-view --resource-group YourResourceGroup --name YourVMName --query "instanceView.statuses[?starts_with(code, 'PowerState/')].displayStatus" -o tsv