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 VMAccess extension and 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. PowerShellCopy
$SubID = "<SUBSCRIPTION ID>"
$RgName = "<RESOURCE GROUP NAME>"
$VmName = "<VM NAME>"
$Location = "<LOCATION>"
Connect-AzAccount
Select-AzSubscription -SubscriptionId $SubID
Set-AzVMAccessExtension -ResourceGroupName $RgName -Location $Location -VMName $VmName -Credential (get-credential) -typeHandlerVersion "2.0" -Name VMAccessAgent
Note
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.
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
myVMAccess
on the VM namedmyVM
in themyResourceGroup
resource group: PowerShellCopy
Set-AzVMAccessExtension -ResourceGroupName "myResoureGroup" -VMName "myVM" -Name "myVMAccess" -Location WestUS -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.
1. If you still can't connect remotely to your virtual machine, see [Troubleshoot Remote Desktop connections to a Windows-based Azure virtual machine](https://learn.microsoft.com/en-us/troubleshoot/azure/virtual-machines/troubleshoot-rdp-connection). If you lose the connection to the Windows domain controller, you will need to restore it from a domain controller backup.
[https://learn.microsoft.com/en-us/azure/active-directory/devices/howto-vm-sign-in-azure-ad-windows](https://learn.microsoft.com/en-us/azure/active-directory/devices/howto-vm-sign-in-azure-ad-windows)
[https://learn.microsoft.com/en-us/shows/it-ops-talk/reset-password-of-an-azure-virtual-machine-vm](https://learn.microsoft.com/en-us/shows/it-ops-talk/reset-password-of-an-azure-virtual-machine-vm)
[https://learn.microsoft.com/en-us/azure/active-directory/devices/howto-vm-sign-in-azure-ad-windows](https://learn.microsoft.com/en-us/azure/active-directory/devices/howto-vm-sign-in-azure-ad-windows)
[https://learn.microsoft.com/en-us/troubleshoot/azure/virtual-machines/reset-rdp](https://learn.microsoft.com/en-us/troubleshoot/azure/virtual-machines/reset-rdp)