In this article, we will discuss about how we can reset the password of our virtual machine using powershell cmdlets.

There is also a way to reset the password of virtual machine from azure management portal. But we will learn to reset the password without using management portal.

Open your powershell ISE window and write these commands –

$azurevm = Get-AzureVM –Name “kkazurevm01” –ServiceName “kkazurevm01”

Set-AzureVMAccessExtension –VM $azurevm –UserName “kkazurevm01” –Password “TestAzurevm01” | Update-AzureVM

Press Enter.

You will see the operation status as Succeeded once the password get reset and VM is updated with new password.

You can check that your old credential will not work and gives you error while logging to virtual machine with old password-



>

Now, try to login with your new password and it will work fine.

So, using Set-AzureVMAccessExtension cmdlet we can reset the password of our virtual machine.