PowerShell create new Azure VM from uploaded disk (not image)
Posted
by
MikeBaz
on Server Fault
See other posts from Server Fault
or by MikeBaz
Published on 2012-11-28T22:38:50Z
Indexed on
2012/11/28
23:05 UTC
Read the original article
Hit count: 273
virtual-machines
|Azure
I have a VHD in Azure storage. That VHD is configured as an OS disk through a command like the following:
Add-AzureDisk -DiskName $newCode -MediaLocation "http://$script:accountName.blob.core.windows.net/$newCode/$sourceVhdName.vhd" `
-Label $newCode -OS "Windows"
I would like to create a new VM pointing at that disk. From what I can tell if I was doing this with an image I would do something like:
New-AzureVMConfig -Name $newCode -InstanceSize $instanceSize `
-MediaLocation "http://$script:accountName.blob.core.windows.net/$newCode/$sourceVhdName.vhd" -ImageName $newCode `
| Add-AzureProvisioningConfig -Windows -Password $adminPassword `
| New-AzureVM -ServiceName $newCode
However this is wrong for me because I don't have an image - I have a configured VHD that is not sysprepped and can't be.
How can I create the VM in PowerShell to point at the existing disk like I can through the portal?
© Server Fault or respective owner