Ana Franco
Ana Franco

Reputation: 1811

Can I use a virtual machine from a previus subscription in azure with a new one?

I had a virtual machine in azure, after a while I stooped using it so I closed my account, everything was supposed to get deleted but now I need to work again in this machine so, I subscribed again and entered the portal.

As a nice surprise, my old virtual machine is still there but, its associated to my old account and it seems like I can't be able to activate it again.

Is there a way for me to activate my old virtual machine and associate it to my new account? or else, why is it still there?

thanks

UPTADE:

This is what I did to create a new virtual machine:

  1. Create new storage
  2. Make copy with azCopy command from old storage to the new one, it takes a while and it copies 6 files.
  3. Inside the virtual machine tab in portal selected "new" to create a new virtual machine
  4. Selected "from gallery option"
  5. Selected Windows Server 2008 R2 SP1 and then hit the arrow ->
  6. Defined a name for the machine, a new username and password, selected standar layer ->
  7. Selected "create a new service in cloud", gave it the same name as the machine, selected the new subscription, selected the same region I did for the storage I created, select the storage I created before and added none availability group. ->
  8. In the last page I left everything as it was, so only the virtual machine agent gets installed, with no extensions and hit the finish link

Then when I open my newly created virtual machine I get a blanked machine without the programs and files I had in the other one.

Upvotes: 0

Views: 132

Answers (2)

Gaurav Mantri
Gaurav Mantri

Reputation: 136206

You get some time between account closure and when the data gets permanently deleted. I'm guessing you're somewhere between that duration.

Since the Virtual Machines are essentially page blobs stored in blob storage, you can certainly reuse them. However for that you would need to copy the files from your old storage account (from your old subscription) to new storage account (in your new subscription). But you don't have to download them to your computer and upload them as Simon suggested. Azure Blob Storage supports server side async copy between storage accounts so you use that. It will be much faster. You can use AzCopy tool to copy files from one storage account to another.

However I recommend that you do the copy now before your previous storage account gets deleted. Because if the account gets deleted, you won't be able to copy the blobs.

UPDATE

Try this syntax for copying VHDs from your old storage account to new storage account:

AzCopy "https://<oldaccountname>.blob.core.windows.net/<oldaccountcontainername .. usually vhds>/" "https://<newaccountname>.blob.core.windows.net/<newaccountcontainername .. again vhds>/" "<filenametocopy.extension"  /SourceKey:<oldaccountkey> /DestKey:<newaccountkey> /BlobType:page /S

Upvotes: 2

Simon Gurevich
Simon Gurevich

Reputation: 306

If the underlying VM disk had something really valuable, try to see if the associated storage account still contains underlying vhds - if so you could try downloading it and then upload it as a OS disk using powershell to reuse

Upvotes: 0

Related Questions