Unable to Connect To Azure VM after Swapping OS Disk

ZO 1 Reputation point
2022-11-11T16:01:18.997+00:00

I am having issues connecting one of our VMs.
First, it takes forever (hours) to complete the start sequence. It says running, but the notifications says Starting virtual machine ...

259632-azure-screen1.png

When trying to connect using RDP, getting the below error.

259594-azure-screen2.png

If I disable that, I am still getting an error that the account cannot be authenticated, which preventing me and everyone else to log on.

I do have an automation set up that swaps the OS disk overnight that is being created each night from a snapshot that was taken months ago. So we have the same machine regardless of changes during our demos.

Any advise on what I should do to make the machine accessible?

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,185 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Manu Philip 16,986 Reputation points MVP
    2022-11-11T18:07:17.737+00:00

    After swapping OS disk, the resource ID should be updated. If you are not following that, make sure to do that.
    Folowing is an example PowerShell script.

    # Get the VM   
    $vm = Get-AzVM -ResourceGroupName myResourceGroup -Name myVM   
      
    # (Optional) Stop/ deallocate the VM  
    Stop-AzVM -ResourceGroupName myResourceGroup -Name $vm.Name -Force  
      
    # Get the new disk that you want to swap in  
    $disk = Get-AzDisk -ResourceGroupName myResourceGroup -Name newDisk  
      
    # Set the VM configuration to point to the new disk    
    Set-AzVMOSDisk -VM $vm -ManagedDiskId $disk.Id -Name $disk.Name   
      
    # Update the VM with the new OS disk  
    Update-AzVM -ResourceGroupName myResourceGroup -VM $vm   
      
    # Start the VM  
    Start-AzVM -Name $vm.Name -ResourceGroupName myResourceGroup  
    

    ----------

    --please don't forget to upvote and Accept as answer if the reply is helpful--


  2. Manu Philip 16,986 Reputation points MVP
    2022-11-11T22:35:35.287+00:00

    The reasons for NLA issues are as follows:

    259683-image.png

    When you swap the disk, the account properties are refreshing and can be a strong reason here:

    The VM has an old copy of the account password, and the DC has a newer cop

    Make sure that, you are avoiding all the points indicated.

    In-order to bring the VM back, you can follow the troubleshooting steps explained here: cannot-connect-rdp-azure-vm

    ----------

    --please don't forget to upvote and Accept as answer if the reply is helpful--

    0 comments No comments