az vm restart

Let us discuss the syntax and usage of the az vm restart Azure CLI command with certain examples of how to use this command.

az vm restart

This Azure CLI command helps you to restart an Azure Virtual Machine.

Syntax

az vm restart [--force][--ids][--name][--resource-group]

Example-1

The below command will restart the AzurelessonsNewVM virtual machine that belongs to the newresgroup Resource group.

az vm restart -g newresgroup -n AzurelessonsNewVM

After executing the above command, I got the expected output as shown in the screenshot below.

az vm restart

Now, to cross-check, I logged in to the Azure Portal, and you can see the status of the Azure Virtual machine is Running.

az vm restart command

Example-2

The below command will restart all the Azure Virtual Machines under the newresgroup Resource Group.

az vm restart --ids $(az vm list -g newresgroup --query "[].id" -o tsv)

After executing the above command, I got the expected output as shown in the screenshot shown below.

az vm restart example

Video Tutorial

You may also like the following articles below.

Azure Virtual Machine

DOWNLOAD FREE AZURE VIRTUAL MACHINE PDF

Download our free 25+ page Azure Virtual Machine guide and master cloud deployment today!