1

Unable to login to the newly created VM from a VHD of a generalized VM in Azure. The steps I'm following are:

  1. De-provision the VM-1.
  2. De-allocate the VM-1.
  3. Generalize the VM-1.
  4. Create a managed disk using the VHD of VM1.
  5. Create a new VM (let's call it VM2) attaching the managed disk created in step 4.
  6. Logging to VM2 throws "permission denied" error.

I've been following first 3 steps from https://docs.microsoft.com/en-us/azure/virtual-machines/linux/capture-image (quick commands section) and next 3 steps from https://docs.microsoft.com/en-us/azure/virtual-machines/linux/upload-vhd (where instead of uploading a vhd, I'm using one of a unmanaged vm.)

I even tried resetting the public key or password from the portal, that fails as well.

Could somebody suggest what wrong am I doing here?

5
  • what you mean with "deprovision vm1"? You have to deprovision the linux agent software. is that what you are doing? May 15, 2017 at 23:14
  • Yes, that is exactly what I'm doing-- sudo waagent -deprovision+user May 15, 2017 at 23:29
  • are you attaching or building "from image"?
    – CtrlDot
    May 15, 2017 at 23:41
  • Attaching the managed disk. Also, between step 3 and 4, I'm creating a new resource group to keep the managed disk created in step 4 and VM created in step 5. May 16, 2017 at 4:31
  • Run ssh with -vvv key and share output. May 16, 2017 at 8:43

1 Answer 1

0

According to your description, I test in my lab. I get the same result with you. I notice that when VM is created, VM extension function is unavailable. It seems that when unmanaged disk converts to managed disk, Azure Linux Agent is not installed correctly. When the VM is creating, waagent will deploy ssh keys.

Configuring SSH authentication types

Deployment of SSH public keys and key pairs

So, it seems that SSH public keys are not created correctly. When try to ssh to VM, it will get Permission denied (publickey).

I suggest you don't need to do step 1 and step 3. Then, you could ssh to your VM, it works for me.

If you don't generalize your VM, you only could create one VM. I suggest you convert VM from unmanaged disk to managed disk. Then, generalize your VM and create multiple VMs.

5
  • My main intention is to publish the image created from the VHDs in marketplace. To publish, I'll have to specify the url's of the VHDs, which should probably be generalized and placed in a blob container. This is the only reason why I chose unmanaged disks, because after customizing the image, I can have both vhds and images(built from vhds) to get it certified. I'm following this link for this process: docs.microsoft.com/en-us/azure/marketplace-publishing/… May 16, 2017 at 18:35
  • @SanjayKulkarni If you only want to create a generalized and placed in a blob container, you don't need to use managed disk. May 17, 2017 at 1:07
  • Just checking in to see if the information provided was helpful. Please let me know if you would like further assistance. May 17, 2017 at 4:18
  • I need to publish this image in marketplace and I've to place the vhd in blob container and when I request microsoft to certify the image, I don't think I can ask them to convert the VM from unmanaged disk to managed disk and then test/certify it. May 17, 2017 at 18:21
  • @SanjayKulkarni Based on my knowledge, you could not publish a image as managed disk, you only could use unmanaged disk. Also, for a managed disk, it should have full function on it, you could do nothing when it becomes a managed disk. So, you could not do sysprep on it. It is why we could not ssh to the VM. May 18, 2017 at 5:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .