Reset Azure VM RDP Access
To reset Azure VM RDP Access, we need the VM access extension installed in an Azure VM. To check the status of the VM Access Extension installation status, please execute the below query after selecting your subscription,
$vm = Get-AzureVM -ServiceName "Cloud_Service_Name_Of_Your_VM" -Name "Your_VM_Name" write-host $vm.VM.ProvisionGuestAgent
If the write-host command returns the value as True, then the VM Access Agent is already installed. If it shows False, then we will have to install the VM Access Agent.
Here, we are assuming that, you have already installed the VM Access Agent in your VM.
To reset the RDP access to your Virtual machine, please run the below power shell query.
$cred=Get-Credential Set-AzureVMAccessExtension -vm $vm -UserName $cred.GetNetworkCredential().Username ` -Password $cred.GetNetworkCredential().Password | Update-AzureVM Set-AzureVMAccessExtension -vm $vm | Update-AzureVM