Search code examples
azure-virtual-machine

Azure VM, your credentials did not work on remote desktop


I've just had a bit of fun trying to connect to a new VM I'd created, I've found loads of posts from people with the same problem, the answer details the points I've found


Solution

  • (1) For me it worked with

    <VMName>\Username
    Password
    

    e.g.

    Windows8VM\MyUserName
    SomePassword@1
    

    (2) Some people have just needed to use a leading '\', i.e.

    \Username
    Password
    

    Your credentials did not work Azure VM

    (3) You can now reset the username/password from the app portal. There are powershell scripts which will also allow you to do this but that shouldn't be necessary anymore.

    (4) You can also try redeploying the VM, you can do this from the app portal

    (5) This blog says that "Password cannot contain the username or part of username", but that must be out of date as I tried that once I got it working and it worked fine

    https://blogs.msdn.microsoft.com/narahari/2011/08/29/your-credentials-did-not-work-error-when-connecting-to-windows-azure-vms/

    (6) You may find links such as the below which mention Get-AzureVM, that seems to be for classic VMs, there seem to be equivalents for the resource manager VMs such as Get-AzureRMVM

    https://blogs.msdn.microsoft.com/mast/2014/03/06/enable-rdp-or-reset-password-with-the-vm-agent/

    For complete novices to powershell, if you do want to go down that road here's the basics you may need. In the end I don't believe I needed this, just point 1

    unInstall-Module AzureRM
    Install-Module AzureRM -allowclobber
    Import-Module AzureRM
    Login-AzureRmAccount (this will open a window which takes you through the usual logon process)
    
    Add-AzureAccount (not sure why you need both, but I couldn’t log on without this)
    
    Select-AzureSubscription -SubscriptionId <the guid for your subscription>
    
    Set-AzureRmVMAccessExtension -ResourceGroupName "<your RG name>" -VMName "Windows8VM" -Name "myVMAccess" -Location "northeurope" -username <username> -password <password>
    

    (7) You can connect to a VM in a scale set as by default the Load Balancer will have Nat Rules mapping from port onwards 50000, i.e. just remote desktop to the IP address:port. You can also do it from a VM that isn't in the scale set. Go to the scale set's overview, click on the "virtual network/subnet", that'll give you the internal IP address. Remote desktop from the other one