Skip to content

Commit 5185466

Browse files
authored
Merge pull request #85909 from genlin/master11
remove delete vm step
2 parents 39281d2 + 067216c commit 5185466

File tree

4 files changed

+127
-167
lines changed

4 files changed

+127
-167
lines changed

articles/virtual-machines/troubleshooting/reset-local-password-without-agent.md

Lines changed: 18 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -25,73 +25,23 @@ You can reset the local Windows password of a VM in Azure using the [Azure porta
2525
## Overview of the process
2626
The core steps for performing a local password reset for a Windows VM in Azure when there is no access to the Azure guest agent is as follows:
2727

28-
1. Delete the source VM. The virtual disks are retained.
28+
1. Stop the affected VM.
29+
1. Create a snapshot for the OS disk of the VM.
30+
1. Create a copy of the OS disk from the snapshot.
31+
1. Attach and mount the copied OS disk to another Windows VM, then create some config files on the disk. The files will help you to reset the password.
32+
1. Unmount and detach the copied OS disk from the troubleshooting VM.
33+
1. Swap the OS disk for the affected VM.
2934

30-
2. Attach the source VM's OS disk to another VM on the same location within your Azure subscription. This VM is referred to as the troubleshooting VM.
31-
32-
3. Using the troubleshooting VM, create some config files on the source VM's OS disk.
33-
34-
4. Detach the VM's OS disk from the troubleshooting VM.
35-
36-
5. Use a Resource Manager template to create a VM, using the original virtual disk.
37-
38-
6. When the new VM boots, the config files you create update the password of the required user.
39-
40-
> [!NOTE]
41-
> You can automate the following processes:
42-
>
43-
> - Creating the troubleshooting VM
44-
> - Attaching the OS disk
45-
> - Re-creating the original VM
46-
>
47-
> To do this, use the [Azure VM Recovery Scripts](https://github.com/Azure/azure-support-scripts/blob/master/VMRecovery/ResourceManager/README.md). If you choose to use the Azure VM Recovery Scripts, you can use the following process in the "Detailed steps" section:
48-
> 1. Skip steps 1 and 2 by using the scripts to attach the OS disk of the affected VM to a recovery VM.
49-
> 2. Follow steps 3–6 to apply the mitigations.
50-
> 3. Skip steps 7–9 by using the scripts to rebuild the VM.
51-
> 4. Follow steps 10 and 11.
52-
53-
## Detailed steps for Resource Manager
35+
## Detailed steps for the VM with Resource Manager deployment
5436

5537
> [!NOTE]
5638
> The steps do not apply to Windows domain controllers. It only works on standalone server or a server that is a member of a domain.
5739
58-
Always try to reset a password using the [Azure portal or Azure PowerShell](reset-rdp.md?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json) before trying the following steps. Make sure you have a backup of your VM before you start.
40+
Always try to reset a password using the [Azure portal or Azure PowerShell](reset-rdp.md?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json) before trying the following steps. Make sure you have a backup of your VM before you start.
5941

60-
1. Delete the affected VM in Azure portal. Deleting the VM only deletes the metadata, the reference of the VM within Azure. The virtual disks are retained when the VM is deleted:
61-
62-
* Select the VM in the Azure portal, click *Delete*:
63-
64-
![Delete existing VM](./media/reset-local-password-without-agent/delete-vm.png)
65-
66-
2. Attach the source VM’s OS disk to the troubleshooting VM. The troubleshooting VM must be in the same region as the source VM's OS disk (such as `West US`):
67-
68-
1. Select the troubleshooting VM in the Azure portal. Click *Disks* | *Attach existing*:
69-
70-
![Attach existing disk](./media/reset-local-password-without-agent/disks-attach-existing.png)
71-
72-
2. Select *VHD File* and then select the storage account that contains your source VM:
73-
74-
![Select storage account](./media/reset-local-password-without-agent/disks-select-storage-account.png)
75-
76-
3. Select the source container. The source container is typically *vhds*:
77-
78-
![Select storage container](./media/reset-local-password-without-agent/disks-select-container.png)
79-
80-
4. Select the OS vhd to attach. Click *Select* to complete the process:
81-
82-
![Select source virtual disk](./media/reset-local-password-without-agent/disks-select-source-vhd.png)
83-
84-
3. Connect to the troubleshooting VM using Remote Desktop and ensure the source VM's OS disk is visible:
85-
86-
1. Select the troubleshooting VM in the Azure portal and click *Connect*.
87-
88-
2. Open the RDP file that downloads. Enter the username and password of the troubleshooting VM.
89-
90-
3. In File Explorer, look for the data disk you attached. If the source VM’s VHD is the only data disk attached to the troubleshooting VM, it should be the F: drive:
91-
92-
![View attached data disk](./media/reset-local-password-without-agent/troubleshooting-vm-file-explorer.png)
93-
94-
4. Create `gpt.ini` in `\Windows\System32\GroupPolicy` on the source VM’s drive (if gpt.ini exists, rename to gpt.ini.bak):
42+
1. Take a snapshot for the OS disk of the affected VM, create a disk from the snapshot, and then attach the disk to a troubleshoot VM. For more information, see [Troubleshoot a Windows VM by attaching the OS disk to a recovery VM using the Azure portal](troubleshoot-recovery-disks-portal-windows.md).
43+
2. Connect to the troubleshooting VM using Remote Desktop.
44+
3. Create `gpt.ini` in `\Windows\System32\GroupPolicy` on the source VM’s drive (if gpt.ini exists, rename to gpt.ini.bak):
9545

9646
> [!WARNING]
9747
> Make sure that you do not accidentally create the following files in C:\Windows, the OS drive for the troubleshooting VM. Create the following files in the OS drive for your source VM that is attached as a data disk.
@@ -107,7 +57,7 @@ Always try to reset a password using the [Azure portal or Azure PowerShell](rese
10757
10858
![Create gpt.ini](./media/reset-local-password-without-agent/create-gpt-ini.png)
10959
110-
5. Create `scripts.ini` in `\Windows\System32\GroupPolicy\Machines\Scripts\`. Make sure hidden folders are shown. If needed, create the `Machine` or `Scripts` folders.
60+
4. Create `scripts.ini` in `\Windows\System32\GroupPolicy\Machines\Scripts\`. Make sure hidden folders are shown. If needed, create the `Machine` or `Scripts` folders.
11161
11262
* Add the following lines the `scripts.ini` file you created:
11363
@@ -119,7 +69,7 @@ Always try to reset a password using the [Azure portal or Azure PowerShell](rese
11969
12070
![Create scripts.ini](./media/reset-local-password-without-agent/create-scripts-ini.png)
12171
122-
6. Create `FixAzureVM.cmd` in `\Windows\System32` with the following contents, replacing `<username>` and `<newpassword>` with your own values:
72+
5. Create `FixAzureVM.cmd` in `\Windows\System32` with the following contents, replacing `<username>` and `<newpassword>` with your own values:
12373
12474
```
12575
net user <username> <newpassword> /add
@@ -131,39 +81,13 @@ Always try to reset a password using the [Azure portal or Azure PowerShell](rese
13181
13282
You must meet the configured password complexity requirements for your VM when defining the new password.
13383
134-
7. In Azure portal, detach the disk from the troubleshooting VM:
135-
136-
1. Select the troubleshooting VM in the Azure portal, click *Disks*.
137-
138-
2. Select the data disk attached in step 2, click *Detach*:
139-
140-
![Detach disk](./media/reset-local-password-without-agent/detach-disk.png)
141-
142-
8. Before you create a VM, obtain the URI to your source OS disk:
143-
144-
1. Select the storage account in the Azure portal, click *Blobs*.
145-
146-
2. Select the container. The source container is typically *vhds*:
147-
148-
![Select storage account blob](./media/reset-local-password-without-agent/select-storage-details.png)
149-
150-
3. Select your source VM OS VHD and click the *Copy* button next to the *URL* name:
151-
152-
![Copy disk URI](./media/reset-local-password-without-agent/copy-source-vhd-uri.png)
153-
154-
9. Create a VM from the source VM’s OS disk:
155-
156-
1. Use [this Azure Resource Manager template](https://github.com/Azure/azure-quickstart-templates/tree/master/201-vm-specialized-vhd-new-or-existing-vnet) to create a VM from a specialized VHD. Click the `Deploy to Azure` button to open the Azure portal with the templated details populated for you.
157-
158-
2. If you want to retain all the previous settings for the VM, select *Edit template* to provide your existing VNet, subnet, network adapter, or public IP.
84+
6. In Azure portal, detach the disk from the troubleshooting VM.
15985
160-
3. In the `OSDISKVHDURI` parameter text box, paste the URI of your source VHD obtain in the preceding step:
161-
162-
![Create a VM from template](./media/reset-local-password-without-agent/create-new-vm-from-template.png)
86+
7. [Change the OS disk for the affected VM](troubleshoot-recovery-disks-portal-windows.md#swap-the-os-disk-for-the-vm).
16387
164-
10. After the new VM is running, connect to the VM using Remote Desktop with the new password you specified in the `FixAzureVM.cmd` script.
88+
8. After the new VM is running, connect to the VM using Remote Desktop with the new password you specified in the `FixAzureVM.cmd` script.
16589
166-
11. From your remote session to the new VM, remove the following files to clean up the environment:
90+
9. From your remote session to the new VM, remove the following files to clean up the environment:
16791
16892
* From %windir%\System32
16993
* remove FixAzureVM.cmd
@@ -263,7 +187,7 @@ Always try to reset a password using the [Azure portal or Azure PowerShell](http
263187
264188
1. Select the troubleshooting VM in the Azure portal, click *Disks*.
265189
266-
2. Select the data disk attached in step 2, click *Detach:*, then click *OK*.
190+
2. Select the data disk attached in step 2, click **Detach**, then click **OK**.
267191
268192
![Detach disk](./media/reset-local-password-without-agent/data-disks-classic.png)
269193

articles/virtual-machines/troubleshooting/reset-password.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ ms.service: virtual-machines-linux
1212
ms.workload: infrastructure-services
1313
ms.tgt_pltfrm: vm-linux
1414
ms.topic: troubleshooting
15-
ms.date: 06/15/2018
15+
ms.date: 08/20/2019
1616
ms.author: delhan
1717

1818
---
@@ -27,11 +27,14 @@ You can't log in to the VM, and you receive a message that indicates that the pa
2727

2828
## Manual password reset procedure
2929

30-
1. Delete the VM and keep the attached disks.
30+
> [!NOTE]
31+
> The following steps does not apply to the VM with unmanaged disk.
3132
32-
2. Attach the OS Drive as a data disk to another temporal VM in the same location.
33+
1. Take a snapshot for the OS disk of the affected VM, create a disk from the snapshot, and then attach the disk to a troubleshoot VM. For more information, see [Troubleshoot a Windows VM by attaching the OS disk to a recovery VM using the Azure portal](troubleshoot-recovery-disks-portal-linux.md).
3334

34-
3. Run the following SSH command on the temporal VM to become a super-user.
35+
2. Connect to the troubleshooting VM using Remote Desktop.
36+
37+
3. Run the following SSH command on the troubleshooting VM to become a super-user.
3538

3639
```bash
3740
sudo su
@@ -95,9 +98,9 @@ You can't log in to the VM, and you receive a message that indicates that the pa
9598
umount /tempmount
9699
```
97100

98-
11. Detach the disk from the management portal.
101+
11. In Azure portal, detach the disk from the troubleshooting VM.
99102

100-
12. Recreate the VM.
103+
12. [Change the OS disk for the affected VM](troubleshoot-recovery-disks-portal-linux.md#swap-the-os-disk-for-the-vm).
101104

102105
## Next steps
103106

0 commit comments

Comments
 (0)