Reset Remote Desktop Services or its administrator password in a Windows VM
Applies to: ✔️ Windows VMs
Note
Was this article helpful? Your input is important to us. Please use the Feedback button on this page to let us know how well this article worked for you or how we can improve it.
Note
The steps in this article don't apply to Windows domain controllers.
If you can't connect to a Windows virtual machine (VM), you can reset Remote Desktop Services and credentials by using the VMAccess extension. Here are the available methods to do this:
If you're using PowerShell, make sure that you have the latest PowerShell module installed and configured and are signed in to your Azure subscription. You can also perform these steps for VMs created with the classic deployment model.
Reset by using the Azure portal
First, sign in to the Azure portal and then select Virtual machines on the left menu.
Reset the local administrator account password
Select your Windows VM and then select Reset password under Help. The Reset password window is displayed.
Select Reset password, enter a username and a password, and then select Update.
Tip
If you enter a different name than the current local administrator account on your VM, the VMAccess extension will add a local administrator account with that name, and assign your specified password to that account. If the local administrator account on your VM exists, the VMAccess extension will reset the password. If the account is disabled, the VMAccess extension will enable it.
Try connecting to your VM again.
Reset the Remote Desktop Services configuration
This process will enable Remote Desktop service in the VM, and create a firewall rule for the default RDP port 3389.
Select your Windows VM and then select Reset password under Help. The Reset password window is displayed.
Select Reset configuration only and then select Update.
Try connecting to your VM again.
Reset by using the Azure PowerShell
First, make sure that you have the latest PowerShell module installed and configured and are signed in to your Azure subscription by using the Connect-AzAccount cmdlet.
Reset the local administrator account password
Reset the administrator password or user name with the Set-AzVMAccessExtension PowerShell cmdlet. The
typeHandlerVersion
setting must be 2.0 or greater, because version 1 is deprecated.$SubID = "<SUBSCRIPTION ID>" $RgName = "<RESOURCE GROUP NAME>" $VmName = "<VM NAME>" Connect-AzAccount Select-AzSubscription -SubscriptionId $SubID Set-AzVMAccessExtension -ResourceGroupName $RgName -VMName $VmName -Credential (get-credential) -typeHandlerVersion "2.0" -Name VMAccessAgent
Reset the Remote Desktop Services configuration
Reset remote access to your VM with the Set-AzVMAccessExtension PowerShell cmdlet. The following example resets the access extension named
VMAccessAgent
on a VM in the resource group:$SubID = "<SUBSCRIPTION ID>" $RgName = "<RESOURCE GROUP NAME>" $VmName = "<VM NAME>" Connect-AzAccount Select-AzSubscription -SubscriptionId $SubID Set-AzVMAccessExtension -ResourceGroupName $RgName -VMName $VmName -Name VMAccessAgent -typeHandlerVersion "2.0" -ForceRerun $true
Tip
At any point, a VM can have only a single VM access agent. To set the VM access agent properties, use the
-ForceRerun
option. When you use-ForceRerun
, ensure you use the same name for the VM access agent that you might have used in any previous commands.If you still can't connect remotely to your virtual machine, see Troubleshoot Remote Desktop connections to a Windows-based Azure virtual machine. If you lose the connection to the Windows domain controller, you will need to restore it from a domain controller backup.
Next steps
If the Azure VM access extension fails to install you can troubleshoot VM extension issues.
If you're unable to reset the password using the VM access extension then you can reset the local Windows password offline. This method is more advanced and requires you to connect the virtual hard disk of the problematic VM to another VM. Follow the steps documented in this article first, and attempt the offline password reset method only if those steps don't work.
Troubleshoot Remote Desktop connections to a Windows-based Azure virtual machine.
Contact us for help
If you have questions or need help, create a support request, or ask Azure community support. You can also submit product feedback to Azure feedback community.