Azure – How to backup Azure VM in a Resource Group

azurevirtual-machines

Is is possible to backup or take a snapshot of a VM created with the Azure preview portal in a Resource Group (not classic/CloudService-based ones)? These new VMs are not visible from the old portal, so I cannot use Azure Backup, and the VM blade does not show any option to capture it/take a snapshot.

Thanks in advance!

Best Answer

Have not seen a snapshot function in the new portal either. The preview portal is still in development, so I would have an eye on it.

In the meantime you can use PowerShell as a workaround. Here are two PowerShell samples: a) how to make a snapshot and b) how to make a blob copy.

a) how to make a snapshot

https://gist.github.com/pkirch/29f5dc62fcdd640d8627

# step 1: get file
$blobFile = Get-AzureStorageBlob -Container source | Where-Object -Property Name -eq "version.txt"

# step 2: create snapshot
$cloudBlob = $blobFile.ICloudBlob
$cloudBlob.CreateSnapshot()

# step 3: get snapshots
$snapshot = Get-AzureStorageBlob -Container source | Where-Object -Property SnapshotTime

# step 4: download snapshot
$snapshot[0] | Get-AzureStorageBlobContent

b) how to make a blob copy

https://gist.github.com/pkirch/569c7880d630ddde95bb

"--> Set current storage account."
Set-AzureSubscription -SubscriptionName "My Subscription Name" -CurrentStorageAccountName "storagesource"

"--> Get blobs from containers 'source1' and 'source2' from current storage account (storagesource)."
Get-AzureStorageBlob -Container source1
Get-AzureStorageBlob -Container source2

"--> Copy BLOBs from container 'source1' into 'source2'. Each copy command shows the copied BLOBs."
"--> Copy BLOB 'Test1.txt'."
Start-AzureStorageBlobCopy -SrcBlob "Test1.txt" -SrcContainer source1 -DestContainer source2
"--> Copy BLOB 'Test2.txt'."
Start-AzureStorageBlobCopy -SrcBlob "Test2.txt" -SrcContainer source1 -DestContainer source2
Related Topic