skip to Main Content

I can successfully create a VM disk snapshot using az cli.
How can i copy the snapshot to an azure storage account using az cli ?

2

Answers


  1. How can i copy the snapshot to an azure storage account using az cli ?

    You can use the command below to copy the VM snapshot to an Azure storage account using Azure CLI.

    First, copy the VM snapshot URL from the portal:

    Azure Portal > Snapshots > select your snapshot > Snapshot export > generate URL.

    enter image description here

    Command:

    az storage blob copy start --account-name "venkat679" --destination-blob "abcd.vhd" --destination-container "test" --account-key "<Your account key>" --source-uri "<snapshoturl>"
    

    Output:

    {
      "client_request_id": "bc99xxxxxee-a269-00155df677e8",
      "copy_id": "xxxx",
      "copy_status": "pending",
      "date": "2024-04-04T06:15:30+00:00",
      "etag": ""0x8DC546EA152C803"",
      "last_modified": "2024-04-04T06:15:30+00:00",
      "request_id": "8xxxxx,
      "version": "2022-11-02",
      "version_id": null
    }
    

    enter image description here

    It takes some time to finish the copy process, and after some time, it will reflect in your storage container.

    Portal:

    The file has been successfully copied to an Azure storage container.

    enter image description here

    Reference:

    az storage blob copy | Microsoft Learn

    Login or Signup to reply.
  2. Use the ‘az storage blob copy start’ command.

    Authenticate to your Azure account:

    az login
    

    Initite the copy operation:


    bash

    az storage blob copy start --destination-blob <blob-name> --destination-container <container-name> --account-name <storage-account-name> --source-uri <source-uri>
    

    You can monitor the copy operation status:

    bash

    az storage blob copy show --container-name <container-name> --account-name <storage-account-name> --name <blob-name>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search