How to Restart a Virtual Machine in Azure ( Quick & Easy Guide )

In this tutorial, we will learn How to restart a virtual machine in azure.

Restart-AzVM

You can restart the Azure virtual machine using Restart-AzVM Azure PowerShell cmdlet

While managing virtual machines in Azure as an administrator you might come across a situation where you need to restart a virtual machine due to a planned maintenance or availability and connectivity issues between VMs and associated disks.

Let’s find out How to restart a virtual machine in Azure from Azure Portal.

  • Logon to Azure portal
  • Click on Virtual Machine under Azure Services
  • Click on the Virtual Machine which you want to Restart.
  • To restart the Virtual Machine Click on the Restart button.
  • Your virtual machine will be restart.

Let’s go through the above-mentioned steps in detail with an example

How to Restart a Virtual Machine in Azure: Step by Step Guide

To restart a virtual machine in Azure follow the below steps :

Step 1: Logon to Azure portal

Step 2: Click on Virtual Machine under Azure Services

How to restart a virtual machine in azure

Step 3: Click on the Virtual Machine which you want to Restart

Select the required VM from the list of available VMs.In this example test VM

Step 4: To restart the Virtual Machine Click on the Restart button.

Provide confirmation: Do you want to restart ‘test VM’.Click on Yes

Your Virtual Machine will be restarted.

How to Restart Azure VM using PowerShell

To restart Azure VM using PowerShell we will use the Restart-AzVM cmdlet

Syntax :

Restart-AzVM -ResourceGroupName "YourResourcegroupName" -Name "VirtualMachineName"

Let’s go through an example

Step 1: Logon to Power Shell

Start PowerShell and Run as an administrator with mouse right-click.

Step 2: Restart your virtual machine using the Restart-AzVM cmdlet

In this example, we are going to restart a virtual machine name “VM1” which is in the resource group ““learn-772a8de9-0062-4b0a-adde-63f2a6c528be”

Restart-AzureRmVM -ResourceGroupName "learn-772a8de9-0062-4b0a-adde-63f2a6c528be" -Name "VM1"

This will restart your Azure virtual machine.

The above command will restart the VM1 virtual machine in the learn-772a8de9-0062-4b0a-adde-63f2a6c528be resource group.

You can check the status of the virtual machine using Get-AzureRmVM:

Get-AzureRmVM ` -ResourceGroupName "resourcegroupname" ` -Name "yourvmName" ` -Status

The above command will show the status of your virtual machine.

How To Change Password for Azure Database

To Change the password for the Azure database for MySql follow the below steps.

Step-1: Login to Azure Portal

Step-2: Go to  Azure Database for MySQL server.

Step-3: Under the Overview page, click on the Reset password button available on the top.

Your Azure Database for MySql server password will be reset.

How to Restart Azure Application Gateway

We don’t have any option in the Azure portal like a simple Restart button using which we can restart the Azure Application Gateway.

To restart Azure Application Gateway we can use either Azure PowerShell or Azure CLI.

Enclosed are the steps to Restart Azure Application Gateway. First, we will stop the application gateway assuming it is currently running.

Step-1: Start PowerShell in administrator mode.

Start PowerShell and Run as an administrator with mouse right-click.

Step-2: To stop the Azure Application Gateway use the below PowerShell cmdlet.

Stop-AzureRmApplicationGateway 

Syntax

Stop-AzureRmApplicationGateway
    -ApplicationGateway <PSApplicationGateway>
    [-AsJob]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

“Stop-AzureRmApplicationGateway “will stop an application Gateway.

Example: How to Stop an Application Gateway

Stop-AzureRmApplicationGateway -ApplicationGateway $TestGw

The preceding command will stop an application gateway running on TestGw

Now to start the application gateway use the below-mentioned cmdlet

Start-AzureRmApplicationGateway

Syntax

Start-AzureRmApplicationGateway
     -ApplicationGateway <PSApplicationGateway>
     [-DefaultProfile <IAzureContextContainer>]
     [<CommonParameters>]

Example1: How to Start an application Gateway

Start-AzureRmApplicationGateway -ApplicationGateway $TestGw

The preceding command will start an application gateway running on TestGw

You can also use Azure CLI to Restart an Azure Application Gateway.

Enclosed are the commands to restart an Azure Application Gateway using Azure CLI

Use the below command to stop the Azure Application Gateway with Azure CLI

Syntax

az network application-gateway stop [--ids]
                                    [--name]
                                    [--resource-group]
                                    [--subscription]
az network application-gateway stop -g YourResourceGroup -n YourAppGateway
  • YourResourceGroup: Provide the name of your resource group
  • YourAppGateway : Provide the name of your application Gateway

Use the below command to start the Azure Application Gateway using the Azure CLI.

Syntax

az network application-gateway start [--ids]
                                     [--name]
                                     [--resource-group]
                                     [--subscription]
az network application-gateway start -g YourResourceGroup -n YourAppGateway

The preceding command will start your application gateway running on the specified resource group

We hope this tutorial on How to restart a virtual machine in azure was helpful.

Related articles :

How to Check Azure Credit ( Easy Guide )

The term Get-AzureAccount is not recognized error: How to fix it

How to fix Because of Protocol Error Code 0x112d ( Easy Guide)

AZ-120 Exam Study Guide 2021(Planning and Administering Microsoft Azure for SAP Workloads)

You are not eligible for an Azure Subscription