Written by 9:05 am Microsoft, Microsoft Azure, Virtualization, Windows, Windows Server • 6 Comments

How to Reset RDP and Admin Password of an Azure VM

Reset RDP and Admin Password Azure VM

I think we all had that experience where we suddenly couldn’t use Remote Desktop Services (RDP) to access our Windows Server anymore. Luckily, if this happens to an Azure virtual machine (VM), we can use the VMAccess extension to reset the RDP configuration as well as the password of the Azure VM. You can reset the RDP configuration or the Azure virtual machine password using the Azure portal or Azure PowerShell.

Reset the administrator password of an Azure VM 🔓

To reset the password of an Azure VM, you can use the Azure portal or Azure PowerShell. If you take the portal path, log in to the Azure portal, go to the Azure VM, you want to reset the password. Under Support + Troubleshooting, click on Reset Password, and follow to the Reset Password wizard to update the credentials. Note that this is not supported for Active Directory Domain Controllers.

Reset Administrator Password of an Azure VM

Reset Administrator Password of an Azure VM

If you want to use Azure PowerShell, you can run the following commands:

$SubID = "SUBID" 
$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

This should help you to reset the password of an Azure Virtual Machine (VM) if you lost access to it. If you want to know more, read the following troubleshooting article on Microsoft Docs.

Reset RDP configuration 👩‍💻

If you can access your Azure Virtual Machine using RDP, you can reset the configuration, and this will enable Remote Desktop service in the VM and create a firewall rule for the default RDP port 3389. To reset the Remote Desktop Service (RDP) configuration, you again login to the Azure portal, select the virtual machine you want to reset the RDP configuration. Under Support + Troubleshooting, click on Reset Password, on the new blade select Reset configuration only, and click on update.

Reset Remote Desktop Services RDP of an Azure VM

Reset Remote Desktop Services RDP of an Azure VM

There is also an Azure PowerShell command available to do this:

$SubID = "SUBSCRIPTION ID" 
$RgName = "RESOURCE GROUP NAME" 
$VmName = "VM NAME" 
$Location = "LOCATION"
 
Connect-AzAccount 
Select-AzSubscription -SubscriptionId $SubID 
Set-AzVMAccessExtension -ResourceGroupName $RgName" -VMName $VmName" -Name "myVMAccess" -Location $Location -typeHandlerVersion "2.0" -ForceRerun

I hope this gives you an overview of how you can Reset your Remote Desktop Service of an Azure Virtual Machine (VM) if you lost access to it. If you want to know more, read the following troubleshooting article on Microsoft Docs. You can also use Azure PowerShell in Cloud Shell.

If you want to know more about how you migrate your virtual machines to Azure, check out my blog post about Azure Migrate.

 

Tags: , , , , , , , , , , , , , , Last modified: December 5, 2019
Close Search Window
Close