Reset Forgotten Azure VM Admin Password Without Azure VM Agent

If you are unable to reset the local administrator password for an Azure Virtual Machine (VM) using the built-in Azure reset methods (such as redeploy and reapply), you can manually reset the password using the following steps. This method involves creating an OS disk snapshot, attaching it to another VM, and using NTPWEdit 0.7 to reset the password.

What is Azure Password Reset?

Azure Password Reset is a feature provided by Microsoft Azure that allows administrators or users to reset the password for a local administrator account on an Azure Virtual Machine (VM). This feature is particularly useful when access to a VM is lost due to forgotten passwords or when managing credentials for multiple VMs.

What is Azure VM Agent?

The Azure VM Agent (also known as the Azure Virtual Machine Agent or Windows Azure Guest Agent) is a lightweight, secure process that runs on Azure Virtual Machines (VMs). It facilitates interaction between the VM and the Azure fabric controller, enabling various management and automation tasks. The VM Agent is installed by default on most Azure Marketplace images, but it can also be manually installed on custom VMs.

Prerequisites

You will need the following:

  1. An additional VM (to attach and modify the OS disk).
  2. An OS disk snapshot of the affected VM.
  3. The NTPWEdit 0.7 tool, which can be downloaded from: https://colab.research.google.com/drive/1yRhuS4nuiU57v8nrUYzDSC3szNeZU4S-

Steps to Reset the Password


Step 1. Create an OS Disk Snapshot

  1. Go to the Azure Portal and navigate to your VM.
  2. Under Settings, go to Disks.
  3. Click on the OS Disk Name (e.g., testvm_OsDisk_1_45488e41fa284ba9).
    OS Disk
  4. Select Create Snapshot and choose the Full Snapshot option.
    Create snapshot
  5. In the Azure Portal search bar, search for Snapshots and open it.
    Virtual Machine
  6. Select the newly created snapshot and choose Create Disk to generate a new managed disk from the snapshot.
    Create managed disk

Step 2. Attach the Disk to Another VM

  1. Open another VM (a second VM that is already running in Azure).
  2. Navigate to Disks and select Attach an Existing Disk.
  3. Choose the disk created from the snapshot and mount it.
    Mount the disk

Step 3. Reset the Password Using NTPWEdit

  1. Log in to the second VM.
  2. Download and install NTPWEdit 0.7 from: http://www.cdslow.org.ru/en/ntpwedit/.
  3. Open Disk Management and bring the attached disk online.
    Disk management
  4. Run NTPWEdit.exe as an administrator.
  5. Navigate to the SAM file location:
    • <Attached Disk ID>:\WINDOWS\SYSTEM32\CONFIG\
  6. Open the SAM file and select the local administrator account (the ID number will be 500).
    Open SAM file
  7. Click Change Password, enter a new password, and unlock the account if necessary.
    Change password here
  8. Click Save Changes and exit the application.

Step 4. Detach the Disk and Swap the OS Disk

  1. Return to the Azure Portal and detach the disk from the second VM.
    Detach disk from second VM
  2. Navigate to the original VM (the one with the forgotten password).
  3. Go to Disks and select Swap OS Disk.
    Select Swap OS Disk
  4. Choose the newly created disk from the snapshot and apply the changes.
    Swap OS Disk
  5. Once the disk swap is complete, restart the VM and log in using the newly set password.

Note. If the password reset does not work on the first attempt, you may need to repeat the password reset and swap disk steps 2-3 times for it to take effect.

Up Next
    Ebook Download
    View all
    Learn
    View all