4

I have created a new Azure RM VM in a new resource group.This resource group also contains a new storage account, into which I have copied a VHD for the new VM. This VHD is a copy of one that works well on a different VM in a different resource group and location.

If I go to Boot diagnostics from the portal, I can see the VM sat at the login screen (Windows Server 2012).

I can click connect for the VM and download the RDP connection. My problems start when I try to login. Even though I try the same username and password that gets me into the VM from which the VHD was copied, I get access denied on the new VM.

At this point, I thought that wasn't going to be a big problem because I knew a "Reset Password" option was available from the Azure portal. However, when I browse to this option I see the following message:

The VM agent is either unavailable, or not installed, which may prevent VMAccess from running.

If I enter details for the new password and submit then I get a dialog informing that password is being reset. This appears on screen for approx 20 minutes.

After such a failure I turned to PowerShell.

I ran the following script (with the variables set appropriately):

Set-AzureRmVMAccessExtension -ResourceGroupName $rgName -VMName $vmName -Name $vmName `
-Location $location -UserName $cred.GetNetworkCredential().Username `
-Password $cred.GetNetworkCredential().Password -typeHandlerVersion "2.0"

This came back with the error:

Set-AzureRmVMAccessExtension : Multiple VMExtensions per handler not supported for OS type 'Windows'. VMExtension 'UPWORK1-VM' with handler 
'Microsoft.Compute.VMAccessAgent' already added or specified in input.

Can anyone please suggest how I could possibly login to the VM?

tr0users
  • 413
  • 3
  • 11
  • 16

1 Answers1

2

This VHD is a copy of one that works well on a different VM in a different resource group and location.

According to your description, you don't execute sysprep before your copy your VM. You could not start two VMs at the same time if you don't execute sysprep.

More information about sysprep please refer to this link.

Set-AzureRmVMAccessExtension : Multiple VMExtensions per handler not supported for OS type 'Windows'. VMExtension 'UPWORK1-VM' with handler 
'Microsoft.Compute.VMAccessAgent' already added or specified in input.

On a Azure VM, you could not install two same extensions at the same time, according to the error, it seems that VMAccessAgent has been installed, you need uninstall it firstly. Please refer to the following steps:

1.Stop your copied VM.

2.Uninstall the extensions VMAccessAgent on Azure Portal.

enter image description here

3.Reset your VM password on Azure Portal.

enter image description here

Note: If you want to use your VHD to create multiple VMs, you should execute sysprep to preapre a generalize VHD.

Update:

You credentials did not work

You could try to RDP your VM \user without domain. Refer to this answer.

If it does not work, you could use your new VHD and create a new VHD. Please ensure you should execute sysprep.

Shui shengbao
  • 3,583
  • 1
  • 11
  • 20
  • Thanks for your help Walter. The new VM is in a different Azure subscription and tenant to the old one. This is why I don't think I need to sysprep. It seems the VM can't be stopped (deallocated) if wanting to uninstall an extension. So, I started it then chose to uninstall the VMAccessAgent. This failed but I was then able to use the "Reset password" function. This reported success but still I am not able to login :( I provided a User name in the Reset Password screen of "BizTalkAdmin". When I try to RDP, I give ".\BizTalkAdmin" with the new password but I get "You credentials did not work" – tr0users Apr 28 '17 at 08:03
  • Sorry, I hit enter for the comment before complete - trying for a carriage return! – tr0users Apr 28 '17 at 08:08
  • No, if you don't execute `sysprep`. The two VMs on the Internet will be a conflict. On Azure `Reset Password` function is done by extension `VMAccessAgent`. You could check Azure Portal, if the extension fails, you could not change your password. – Shui shengbao Apr 28 '17 at 08:13
  • If possible, I suggest you could stop copied VM and try again. If possible, could you give me the uninstall extension log? – Shui shengbao Apr 28 '17 at 08:13
  • @tr0users Could you give the error information to your question? Like this [link](https://www.experts-exchange.com/questions/28591782/Your-credentials-did-not-work-while-trying-to-RDP-from-one-Win-7-workstation-to-another.html)? – Shui shengbao Apr 28 '17 at 08:19
  • Ah, I didn't realise that out sys prep. In that case I guess I'd better start again! Here's the log, I think for the extension uninstall:"properties":{ "statusMessage": "{\"status\":\"Failed\",\"error\":{\"code\":\"ResourceOperationFailure\",\"message\":\"The resource operation completed with terminal provisioning state 'Failed'.\",\"details\":[{\"code\":\"VMAgentStatusCommunicationError\",\"message\":\"VM 'UpWork1-VM' has not reported status for VM agent or extensions. Please verify the VM has a running VM agent, and can establish outbound connections to Azure storage.\"}]}}" }, – tr0users Apr 28 '17 at 08:19
  • Let us [continue this discussion in chat](http://chat.stackexchange.com/rooms/57875/discussion-between-walter-msft-and-tr0users). – Shui shengbao Apr 28 '17 at 08:19
  • @tr0users I have updated my answer, if possible, you could try again. – Shui shengbao Apr 28 '17 at 09:11
  • @tr0users Do you solve this issue? Please let me know if you need more help. – Shui shengbao May 01 '17 at 01:04
  • Sorry @walter I ran out of time with this so I deleted everything and resorted to a clean vm from the gallery. – tr0users May 01 '17 at 06:56
  • @tr0users OK. I think my answer is helpful. If possible, you could accept it. It will help more people. – Shui shengbao May 01 '17 at 06:58