

If you made it to the end and would like more advanced stuff, leave comments and I will try to do a more advanced post. It all depends mainly on our ingenuity, remember that. create a snapshot disk at the target location,.move the snapshot to the target location,.create a Storage Account in the target location,.

You might as well create a more complicated script that, after specifying the source disk name, resource group, and target location: I gave a simple example that you can move a snapshot to another region. You can learn how to replace the disk itself in a virtual machine from the previous article: Please note that the created disk cannot be smaller than a snapshot. When you creating a disk as a source, select “Storage blob” and select the image you have just created. When you have move the snapshot to a new location (region), you can easily create a disk using the portal. Start-AzStorageBlobCopy -AbsoluteUri $snapshotaccess.AccessSAS -DestContainer $StorageAccountBlob -DestContext $DestStorageContext -DestBlob "$($vhdname).vhd" -Force -ErrorAction stop $DestStorageContext = New-AzStorageContext –StorageAccountName $storageaccount -StorageAccountKey $StorageAccountKey -ErrorAction stop $snapshotaccess = Grant-AzSnapshotAccess -ResourceGroupName $SnapshotResourceGroup -SnapshotName $SnapshotName -DurationInSecond 3600 -Access Read -ErrorAction stop $snapshot = Get-AzSnapshot -ResourceGroupName $SnapshotResourceGroup -SnapshotName $SnapshotName $StorageAccountKey = (Get-AzStorageAccountKey -Name $StorageAccount -ResourceGroupName $StorageAccountResourceGroup).value $storageaccountResourceGroup = "ResourceGroupNAME2" $StorageAccountBlob = "StorageAccountBlobNAME" $SnapshotResourceGroup = "ResourceGroupNAME1" If you do not have a Storage Account created in the target location, you need to create it. Finally, the name of the created disk image. We give its name, the name of the BLOB to which the disk image will go, and the name of the resource group in which it is located. Before running the script below, you need to correct the variable names in it.Įnter the name of the snapshot you want to move and its resource group.
