locked
How to get lease-id on the blob for a IAAS azure VM which is already created RRS feed

  • Question

  • Hi,

      I am calling Azure REST Api's from c# code to create and apply snapshots for IAAS Virtual machines.

      Create snapshot went well and I got snapshot datetime in response.

    Now I am trying to apply this snapshot to my base blob using REST api (Copy Blob) .

    Since there is already lease acquired on my base blob for infinite period , I have to specify this lease ID in the Copy Blob REST header . I browsed in the azure portal  Storage->Containers->Blob Edit , which will show  blob properties and metadata . But it is shown that lease status as "Locked" however there is no lease-id shown . Also I browsed many azure REST api's but not got any useful way to retrieve the lease-id for the blob.

    Since in my case while creating the Virtual machine , blob is also getting created by default lease-id where I don't have any  way to specify my own lease-id.

    Please guide me to correct way of retieving lease-id which I can specify in the copy Blob rest api.

    Thanks in advance,

    Rakesh

    Friday, February 7, 2014 9:42 AM

Answers

  • if you want restore an IAAS snapshot the only solution is :

    - export the VM

    - delete the VM

    - restore blob snapshot

    - reimport the VM

    There is no mean to apply a blob snapshot while the VHD is attached to an IAAS instance.

    Monday, February 10, 2014 5:23 PM

All replies

  • Unfortunately there's no way to retrieve lease-id after the fact or in other words you get lease id back in response when you acquire the lease but not after that. I'm guessing you would want to break the lease on that blob. If that's your intent, then you don't really need lease id for that. If you look at the REST API documentation here: http://msdn.microsoft.com/en-us/library/windowsazure/ee691972.aspx, you will notice that lease id is not required for breaking the lease.

    Hope this helps.

    Friday, February 7, 2014 1:39 PM
  • if you want restore an IAAS snapshot the only solution is :

    - export the VM

    - delete the VM

    - restore blob snapshot

    - reimport the VM

    There is no mean to apply a blob snapshot while the VHD is attached to an IAAS instance.

    Monday, February 10, 2014 5:23 PM