Create Disk Snapshot and Generate Snapshot Export URL
Step 1: Open Azure Portal >> Sign In and authenticate with your Azure account.
Step 2: Access Azure Virtual machines and select your target Azure VM that you wish to archive.
Step 3: After selecting the Azure VM, select Disk from the VM dashboard (Menu Section)
Step 4: Now, select the virtual machine OS disk or data disk which ever you want to archive of your choice.
Step 5: Create a snapshot of your select disk type either operating system (OS) disk or data disk.
What is Snapshot?
Quick Answer: A snapshot is a full, read-only copy of a virtual hard disk (VHD) which help in restore or rebuild a Virtual machine.
Generate Snapshot export URL
Follow the steps to generate export URL from Azure VM disk snapshot:
Access the Azure Portal >> access Snapshots >> select your target Snapshot >> now from the left pane Settings >> select Snapshot export >> In label box enter URL expiry time in seconds (Default: 3600 Seconds) >> click on Generate URL >> copy Export URL ( you use this URL for archiving to storage account.
Archive Azure VM VHD File to Azure Storage Blob
Pre-requisite: User or Service Principal should have additional RBAC role that is Storage Account Blob Owner or Storage Account Blob Contributor role access to perform this archiving.
Follow the step to archive azure virtual machine .vhd file to storage account container:
Step 1: Sign in to Azure Portal and access Azure Cloud Shell >> switch to Bash Terminal
Step 2: Login to your Azure Tenant account using the following command.
azcopy login --tenant-id="<add your tenant id>"
Step 3: To sign in use the web browser to open the page - https://microsoft.com/devicelogin and Enter the Code xxxxxx to authenticate.
Step 4: Modify and run the following command to archive the disk file to storage container blob with blob type PageBlob.
azcopy copy \ "<add snapshot export URL><_add_snapshot_export_url_>" \ "https://<storageaccount_name><_add_azure_storageaccount_name_>.blob.core.windows.net/<container_name><_add_container_name_>/<add your archive filename><_add_snapshot_name_>.vhd" \ --blob-type PageBlob
Modify and run the following command to archive the disk file to storage container blob with blob type BlockBlob.
azcopy copy \ "<add snapshot export URL><_add_snapshot_export_url_>" \ "https://<storageaccount_name><_add_azure_storageaccount_name_>.blob.core.windows.net/<container_name><_add_container_name_>/<add your archive filename><_add_snapshot_name_>.vhd" \ --blob-type BlockBlob
Step 5: Verify the deployment and navigate to your target Azure Storage account from Azure Portal and change the blob access tier of the file to archive state.
Restore an Archived File from Azure Storage Blob
While a blob is in the Archive access tier, it's considered to be offline and can't be read or modified. In order to read or modify data in an archived blob, you must first re-hydrate the blob to an online tier, either the Hot or Cool tier.
There are two options for re-hydrating a blob that is stored in the Archive tier:
- Copy an archived blob to an online tier
- Change a blob's access tier to an online tier