Luis Abreu
Luis Abreu

Reputation: 4570

creating new VM in azure that uses existing vhd

Is it possible to create a new VM (Azure RM) that uses an existing vhd disk (where everything is already set up) that is already on a storage account? In the new portal, I can't find any option for doing that. But can it be done by editing a template or by using PowerShell? Can anyone point me to any docs about this?

Upvotes: 0

Views: 1307

Answers (2)

Michael B
Michael B

Reputation: 12228

You can deploy an existing Vhd from both PowerShell and ARM Templates.

There are two methods of using an existing image. You can either directly attach that disk or you can use that disk as an image source.

If you look at the Create a Virtual Machine from a User Image template on Github. There is both a template and a PowerShell script.

Both of those are currently configured to make a copy of the Vhd and use that. If you want to directly attach your Vhd you would need to change this line (currently line 168) in the template

"createOption": "FromImage",

to

"createOption": "Attach",

You would do the same for the createoption of Add-AzureVMDataDisk

Upvotes: 1

Sabha Mahadevan
Sabha Mahadevan

Reputation: 11

Yes you can create a Resource Manager VM from a VHD. It is possible through aRMT template. in Github there is a reference template, please edit and deploy that.

Thanks! Sabha Mahadevan

Upvotes: 0

Related Questions