3

Using Azure Powershell create a new VM using my own Vhd based on the tutorial: https://azure.microsoft.com/en-us/documentation/articles/virtual-machines-create-upload-vhd-windows-server/

When try to connect to the VM it pops the error:

The user account is currently disabled and cannot be used.

Below is the scripts for creating the VM

#create the vm using the image
$image = Get-AzureVMImage $MyImage
$vmname = "Test-Machine"
$vmsize = "Large"
$vm1=New-AzureVMConfig -Name $vmname -InstanceSize $vmsize -ImageName $image.imageName
$vm1 | Add-AzureProvisioningConfig -Windows -AdminUsername $username -Password $password
New-AzureVM –ServiceName $myServiceName -VMs $vm1
Paolo
  • 21,270
  • 6
  • 38
  • 69
Peter
  • 31
  • 1
  • 3
  • tried adding the extensions? and was this a generalized (i sysprepped image, or a specialized one (non-sysprep) – techmike2kx Jan 27 '16 at 12:20
  • I added the extensions still return the same error and this image is generalized. – Peter Jan 28 '16 at 19:01
  • sorry only now saw that you answered back .. , did you get it working already? If not can ou try to reset the user and password by using the Set-AzureVMAccessExtension commandlet and using -forceupdate with it? – techmike2kx Feb 04 '16 at 07:50

2 Answers2

3

I just ran into this issue as well, trying to login a fresh Azure Windows 10 virtual machine.

You can fix this issue by:

  1. On the virtual machine page, head over to Run command
  2. Click on EnableAdminAccount
  3. Run the cmdlet

You should see something like:

Admin account was disabled. Enabling the Admin account.

Path          : \\localhost\root\cimv2:Win32_UserAccount.Domain="PaoloWin10",Name="PaoloUser"
RelativePath  : Win32_UserAccount.Domain="PaoloWin10",Name="PaoloUser"
Server        : localhost
NamespacePath : root\cimv2
ClassName     : Win32_UserAccount
IsClass       : False
IsInstance    : True
IsSingleton   : False

You should now be able to login in the virtual machine successfully.

Paolo
  • 21,270
  • 6
  • 38
  • 69
0

In addition to Paolo's answer to run manually the EnableAdminAccount from the Run Command tab of the portal, if your using a VM from an on premise VHD uploaded to an Azure Generalized Image, you would need to add a SetupComplete2.cmd and EnableLocalAdminAccount.ps1 in C:/Windows/OEM to unlock the user account automatically upon VM creation. Strangely enough this does not appear on anywhere on Microsoft's guideline on how to migrate a on-prem VM to Azure, but the official windows image from the Marketplace do have those 2 files that are run after sysprep.

This blog article was also very useful and points towards the creation of a SetupComplete2.cmd https://matt.kotsenas.com/posts/azure-setupcomplete2