One of the main tasks you’ll want to do while running virtual machines is to start and stop them.\nStopping a VM\nWe can stop a running VM with the vm stop command. You must pass the name and resource group, or the unique ID for the VM:\naz vm stop \\\n--name SampleVM \\\n--resource-group \n\n \nWe can verify it has stopped by attempting to ping the public IP address, using ssh, or through the vm get-instance-view command. This final approach returns the same basic data as vm show but includes details about the instance itself. Try typing the following command into Azure Cloud Shell to see the current running state of your VM:\naz vm get-instance-view \\\n--name SampleVM \\\n--resource-group \\\n--query "instanceView.statuses.displayStatus" -o tsv\n \nThis command should return VM stopped as the result.\n \nStarting a VM\nWe can do the reverse through the vm start command.\naz vm start \\\n--name SampleVM \\\n--resource-group \nThis command will start a stopped VM. We can verify it through the vm get-instance-view query, which should now return VM running.\n \nRestarting a VM\nFinally, we can restart a VM if we have made changes that require a reboot using the vm restart command. You can add the --no-wait flag if you want the Azure CLI to return immediately without waiting for the VM to reboot.