Let us discuss the syntax and usage of the az vm restart Azure CLI command with certain examples of how to use this command.
Table of Contents
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 AzurelessonsNewVMAfter executing the above command, I got the expected output as shown in the screenshot below.

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

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.

Video Tutorial
You may also like the following articles below.

I am Rajkishore, and I am a Microsoft Certified IT Consultant. I have over 14 years of experience in Microsoft Azure and AWS, with good experience in Azure Functions, Storage, Virtual Machines, Logic Apps, PowerShell Commands, CLI Commands, Machine Learning, AI, Azure Cognitive Services, DevOps, etc. Not only that, I do have good real-time experience in designing and developing cloud-native data integrations on Azure or AWS, etc. I hope you will learn from these practical Azure tutorials. Read more.
