Azure Created Image Without Generalizing - azure

So I made the mistake of trying to capture an image of my VM without first running sysprep /generalize on it. Now I have a VM I can't start and an image I can't create a VM from.
Is there any way I can restore my original VM so I can create a valid image from it?
I saw this blog post https://learn.microsoft.com/en-us/archive/blogs/shwetanayak/captured-the-virtual-machine-didnt-intend-to-generalize-it-now-what that seems to imply that I can, but it's solution says to create a copy of a VHD using a snapshot. When I try to create the snapshot, nothing shows up in the Source Disk managed disks drop down.

Related

Getting a "snapshot", instead of "custom image" when trying to create a custom image from a VM

I am trying to create a custom image from a running VM. The process seemed to be successful
but the result shows as "snapshot". What I am doing wrong? Or maybe I need to somehow convert a snapshot into an image?
After your snapshot is created you have to create disk, from that disk you will be able to create VM.
Follow these steps:
Click on snapshot and from there click on create disk
As shown here in this ss
After the Disk has been created, go the Disks section click on the disk that you named while creating it from snapshot and click on Create VM As shown here in this ss
and finish the required steps to create vm once it has been created you will be able to access it
Thanks & Regards

Unable to modify Azure VMSS reference image to an image without data disks

My Azure VMSS is deployed successfully and operating as expected. It uses an Azure Compute Gallery reference image (which includes both an OS disk, and 1x Data Disk).
We are now changing all our Compute Gallery reference images to single OS disk-only (since the Terraform Windows VM resource does not support deploying from an image version that has a data disk included, even though Terraform Windows VMSS resource does support it), but when changing the VMSS from dual-disk image, to the single-disk image, Terraform fails with:
Code="PropertyChangeNotAllowed" Message="Changing property 'dataDisks' is not allowed." Target="dataDisks"
NOTE: I have successfully tested the change from the other way around: ie. Updating a VMSS that runs from a single disk image, to pointing to an image that uses 2 disks. This completed fine. It only fails when trying to go from 2 disks down to 1 disk.
(Using: Terraform v1.0.0; AzureRm Provider v3.0.2)
SOLUTION/WORKAROUND:
So, doing it via Terraform fails, however, with a little help from the portal, we can achieve the desired result. In the portal, on the VMSS, under Settings, select Disks. Detach the data disk from the VMSS. Takes a few seconds. Once that is detached, now run the Terraform again to update the image reference to an image with single disk. This time it completes successfully.
Hope this helps someone out there

Nutanix VM migration to Azure - VM creation timed out

In the process of Nuntanix Virtual Machine migration to Azure, I had copied ral-rdmbuild-02 copy.ova file into a windows machine and extracted to get .vmdk and .mf. From the extracted file the .vhd file was created, later it was resized on a ubuntu to meet 1MB requirement.
Subsequently, the .vhd was copied to azure and attempted to create a vm to face the following error. Could someone can help me to overcome this issue.
{"code":"DeploymentFailed","message":"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.","details":[{"code":"OSProvisioningTimedOut","message":"OS Provisioning for VM '' did not finish in the allotted time. The VM may still finish provisioning successfully. Please check provisioning state later. Also, make sure the image has been properly prepared (generalized).\r\n * Instructions for Windows: https://azure.microsoft.com/documentation/articles/virtual-machines-windows-upload-image/ \r\n * Instructions for Linux: https://azure.microsoft.com/documentation/articles/virtual-machines-linux-capture-image/ \r\n * If you are deploying more than 20 Virtual Machines concurrently, consider moving your custom image to shared image gallery. Please refer to https://aka.ms/movetosig for the same."}]}
• Please check whether the Nutanix VM hard disk is configured as a dynamic disk or not because dynamic disks don’t work with Azure, and they can’t be migrated. Also, the image of the Nutanix VM may not be prepared correctly, thus would suggest you recreate the image of the Nutanix VM and try migrating it to Azure once again.
• To convert the dynamic disk to fixed type of virtual disk, kindly refer to the below documentation link that guides to use the appropriate command for converting the same: -
Convert-VHD -Path c:\test\child1vhdx.vhdx -DestinationPath c:\test\child1vhd.vhd -VHDType Fixed
https://learn.microsoft.com/en-us/powershell/module/hyper-v/convert-vhd?view=windowsserver2019-ps
• Also, based on the error message that you are encountering, the OS deployment might have also failed from the Portal side as it was unable to pass on some of the required parameters which is why you got ‘TimeOut’ message. The VM also didn’t finish the deployment correctly. I would recommend trying stop(deallocate) and start the VM and see if that resolves the issue.
I would recommend you delete the VM and its related resources if created and take a snapshot of the OS disk, create a disk from the snapshot and then create the machine from that disk. Please refer to the link below for creating a VM from a ‘VHD’ by using the Azure portal: -
https://learn.microsoft.com/en-us/azure/virtual-machines/linux/create-upload-centos
• Finally, to generalize the VM and execute ‘sysprep’ on a VM to take its correct reference image such that it can be successfully migrated to another environment, please refer to the below link that explains the correct steps to perform for generalizing the VM: -
https://portal.nutanix.com/page/documents/details?targetId=Web-Console-Guide-Prism-v6_1:wc-windows-vm-customize-with-sysprep-clone-vm-wc-t.html

Creating Windows Image from VM using Packer

I have to create an Image from an existing VM using Packer.This is the link I'm following to do so.
Now I have few doubts in this before proceeding further.
Can I run all these commands remotely.
If yes, where should I install Packer , is it on client Machine or remote machine?
If it has to be installed on remote machine, from which the image is being created, is there any workaround for that. I will not have access to install anything on the remote machine.
No where the VM details are not mentioned. Does that mean, it will automatically take the VM details when we run the commands on the VM?
Where can I see the output of the whole process? Will it be available in azure portal?
Any inputs on the above questions are appreciated.Thanks!
First of all, there is something you have misunderstood about Packer.
The Azure builder can create either a VHD, or a managed image. If you
are creating a VHD, you must start with a VHD. Likewise, if you want
to create a managed image you must start with a managed image.
It means you must create the image from the image or VHD, not VM.
The answer to your question.
Yes, you can run the command remotely, just like Azure CLI.
You can install Packer on your on-premise machine.
From the description of Packer, it just needs the image information.
You can see the output where you run the Packer command.
Update
When you want to create the image from VHD file, you can make an instead:
"image_publisher": "Canonical",
"image_offer": "UbuntuServer",
"image_sku": "16.04.0-LTS",
Into
"image_url": "https://my-storage-account.blob.core.windows.net/path/to/your/custom/image.vhd",
If your vm is managed by Azure, you can pay attention to the option of custom_managed_image and images in Azure. Hope this will be helpful.

AzureRM - Ubuntu VM created using uploaded VHD stuck waiting on boot prompt

I have an Ubuntu Server 17.10 VM in vCenter that I exported using Export-VApp, then used Microsoft's Virtual Machine Converter to create a VHD. Created an Azure RM Disk Image from that and spun up a VM, all of which seemed to go fine. My problem is that the New-AzureRMVM gets stuck in creating, and when I go to the boot diagnostics from the screenshot it is stuck on a "Please unlock disk sda5_crypt:". First, from what I gather is there really no way to get console access to my VM so that I can enter this? It won't get past creating so connect is greyed out and I can't SSH into it. Is my only option here to go back to the VM on vCenter and migrate the entire partition to a new partition without disk encryption, then redeploy? Is there any sort of startup file Azure accepts that could input this for me?

Resources