I'm trying to move a VM custom image from one DevTest Lab to another and can't seem to find an easy way to accomplish that. My VM is using managed disks and also has a data disk.
I've read the following article https://azure.microsoft.com/en-us/updates/azure-devtest-labs-changes-in-exporting-custom-image-vhd-files/ and it states that
Azure DevTest Lab now generates a managed image and "…This allows
Sysprep'ed/deprovisioned custom images to support data disks in
addition to the OS disk through a single image."
This is fine but the image that is created can't be exported.
Is it even possible to accomplish, am I missing something?
Thanks for your help
This is fine but the image that is created can't be exported.
The article you posted is right, you can follow it to export the VM OS disk(not image) to your local machine. You should export the VM OS disk from the Resource group which contains your Devtest VM. The main steps are below:
Generate your VM
Go to Azure Portal > find the resource group which name contains your DevtestLab VM :
Then, you can find the Disk and export it to your local machine:
Go to your another Devtest Lab > Configuration and plocies > Custom images > Add > Enter your VHD location and choose the OS type > OK > the coustom image will be uploaded Then you can use it to create your Devtest VM.
Related
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
I am using create_option as from_image to create new vm and passing the old vhd url in it but it is not successfully provisioned.
What steps i need to follow to make it work ?
My vm is in azure from whose os disk i want to create new vms.
You will want to sysprep and generalize your VM and capture an image to use to deploy new VMs.
Follow the documentation located here: https://learn.microsoft.com/en-us/azure/virtual-machines/windows/capture-image-resource
Context:
Trying to create VMs in Azure (cloud) using VMSS in ARM mode and using json templates.
Problem:
Creating a VMSS from an os image and datadisk image using Azure CLI and json template creates new VMSS but not the datadisk.
My success so far:
Successfully created VMs using CLI with both os and data disk from a custom image using json template. Also successfully created VMSS (Virtual Machine Scale Set) from a valid custom os image using CLI with json template.
My research for problem:
There isn't any sample on github for this scenario git hub templates. Microsoft azure site also have sample for os disk only and not creating a VMSS with data disk.
blkid comand doesn't show the data disk at all, meaning it was never created and mounted. My json template virtualMachineProfile->storageProfile declares a valid dataDisks object and I know it's works as it successfully creates VM (not VMSS) with data disk and also CLI doesn't return any error.
I know json based template is new and Microsoft is working on adding more features/functionalities so my questions is "Is there anything wrong that I am doing and is it that creating VMSS with data disk is not yet implemented in Azure ?"
Environment: Linux (Debian/RHEL)
Azure CLI : 0.9.13 (ARM mode)
Azure Api: 2015-06-15
Image: (CentOS 6.7)
Thanks for your help.
As per this blog post VMSS and data disks, it is not yet supported. Such a bummer..... Hopefully Microsoft will soon release this feature before selling VMSS too much.
I need to connect my existing VMs to new Virtual Network. Documentations says you have to redeploy them, but I could not find any source which says how to redeploy an existing VM.
Thanks,
Prasad
Create an image of your VM:
Select your VM
Hit Capture on the bottom bar. Give it a name and make sure it completes successfully
Navigate to Cloud Service >> Select the CS >> Delete >> Chose CS and it's deployments
Review the list of VMs and disks that are going to be deleted
Delete
Redeploy the VM from Image:
Click New >> Compute >> Virtual Machine >> From Gallery
On the right side >> Click My Images >> Select your captured image
Complete the wizard. Make sure to select the correct Virtual Network.
Pre-requisites:
Virtual Network is in the same location as the captured Image. Otherwise you will have to move the VHD to a storage located in the same data center as the new Virtual Network. Virtual Network will not show up on the list if this pre-requisite is not met.
If you intend to use the captured image to deploy several other VMs with the same content you will have to run sysprep (windows) or deprovision waagent (linux) before capturing. Otherwise you will have connectivity problems since all the vms will share the same unique Ids.
More Info:
How to Capture a Windows Virtual Machine to Use as a Template:
http://azure.microsoft.com/en-us/documentation/articles/virtual-machines-capture-image-windows-server/
How to Capture a Linux Virtual Machine to Use as a Template: http://azure.microsoft.com/en-us/documentation/articles/virtual-machines-linux-capture-image/
I'm trying to use the azure command line to start a vm:
azure vm start myvmnamehere
But it's telling me:
No deployments were found
I'm guessing that I need to specify the location "West US"?
azure vm start is going to start a virtual machine that you've already created, within a specific region. To do that, you'd first need to call azure vm create. You would first create your vm from an image in the gallery (and within a dns name, xxxxx.cloudapp.net). To see the images available to you, try running azure vm image list.
Also: don't forget to add --ssh or --rdp so you can have remote access, when calling azure vm create.
Jeff Wilcox blogged about this in more detail, here.