Question

I have taken a backup of my azure VM VHD to blob storage using copy blob feature some time back.Now the VM is not present.Now i want to create the new VM using the Backup VHD in the another storage account using Power shell.

How can i do that using powershell?

Était-ce utile?

La solution

Before you can create a virtual machine you need to create a 'disk' over the blob copy. This can be done using the Add-AzureDisk

Then you can create a Virtual Machine over an existing disk using New-AzureVMConfig and New-AzureVM, example of this has been published here -

$vmI1 = New-AzureVMConfig -Name $machineName -InstanceSize Small -AvailabilitySetName 'RDGW' -DiskName 'MY-OS-Disk-Name' |
Add-AzureDataDisk -Import 'My-Data-Disk-0'  -LUN 0 |
Add-AzureDataDisk -Import 'My-Data-Disk-1' -LUN 1 |
Add-AzureEndpoint -Protocol tcp -LocalPort 443 -PublicPort 443 -Name 'HTTPs' |
Set-AzureSubnet $_subnetInternal, $_subnetDmz, $_subnetProtected 

This creates the VM configuration which is then passed to New-AzureVM

Autres conseils

BTW: it's possible to create VM from VHD blob using web interface. On Virtual Machines tab you can switch to sub tab Images and create new image using vhd from blob. Then it's possible to add new VM using existent vm image.

Using the Azure Portal, after uploading your blob as a "page blob", click All Services and search for Image. Click +Add then define your image, select the blob, and you're off!

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top