Open In App

Microsoft Azure – Archive Azure VM to Azure Storage Account

Improve
Improve
Like Article
Like
Save
Share
Report

In this article, we will be implementing a solution to archive a select azure VM snapshot to a select storage account for archiving using azure cloud shell. For implementation, we will be using Azure CLI commands.

Prerequisite:

  1. VM Snapshot
  2. A storage account is needed
  3. User needs “Storage Blob Contributor Data” IAM Role Access on Archiving Storage Account to perform the following operation.

VM Archive Implementation:  

Follow the below steps to archive Azure VM to Azure Storage Account: 

Step 1: Open Bash in Cloud Shell  

Step 2:  Use the following for Logging into the tenant.

azcopy login --tenant-id=<tenent_id>

This command returns the login url and login code. Use that code to log in.

Step 3: Now, click on the URL and Paste the Code to log in. 

Once you logged in close the tab and navigate back to cloud shell and follow the next steps.

Step 4:  Use this command to store the snapshot copy to the storage account container.

azcopy copy "<snapshot_export_url>" \
"https://<storageaccount_name>.blob.core.windows.net/<container_name>/<snapshot_name>.vhd" \
--blob-type BlockBlob

Fill up the details in the command. Add <snapshot export url>, Add <storage account name>,  Add Storage Account <container name>, Add <snapshot name>.

Step 5: Once done, go to the storage account container and change tier to Archive. That’s it!

Getting the Snapshot Export URL:

Follow the below steps to get the Snapshot export URL:

Step 1: Go to Snapshots from Azure Portal.

Step 2: Select the Snapshot which you want to archive.

Step 3: Navigate to Settings >> Access Snapshot export >> Click on Generate URL to generate a secure URL.


Last Updated : 30 Mar, 2023
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads