Unable to recreate Azure VM deleted after going over free limit - azure

I had two VMs running in azure and went over my free limit for this month. I enabled the ability to charge my account and found they were gone.
The VM disks are still there but the VMs themselves have been made into hosted services. To recreate the VM I deleted the hosted service, then went to the create new VM dialog like I've seen others post previously. Under the "create from disk" option I do not see either of my OS disks as options to create a VM. Is this the right way to recreate VMs or am I missing something?
Also of note, the disks still show up as attached to the deleted VMs in the portal.

As you mentioned that your OS VHD still shows connected with deleted VM, you would need to take care that first. You can run the BreakLease.ps1 Powershell script in this forum discussion to remove the lease first and then use the Os disk VHD to create a new OS Image. Finally you can use the new OS image to create your new Virtual machine.
Alternatively if you just want to reuse the same OS disk vhd to create a new virtual machine, you can follow the blog below and look for section at the bottom "To reuse the OS VHD blob to create OS Image" to copy the blocked OS blob into a new blob and then use it:
Using OS disk VHD to create a new Virtual Machine if OS VHD is still on lease in Windows Azure Virtual Machines

Related

How to chage a VM's os Disk

I have created a VM (Standard DS11 v2) on Azure about 2 - 3 weeks ago. It attached a premium disk which has extra price. (I did not know that when I created the VM.)
Now I want to change this disk to a standard disk. As I see, it is not possible to downgrade a premium disk to standard.
What I am trying to do is:
Attach a standard disk to my VM.
Copy premium disk to standard disk.
Make standard disk OS disk.
Detach premium disk.
Delete premium disk.,
How can I do that?
Also I am open to different solutions to my problem.
My OS is Centos 7.2.
You could not resize Ds series VM to D series VM.
Based on my knowledge, you could recreate your VM by using your VHD.
Please refer the following steps.
Stop and delete your VM but don't delete the VM's VHD.
Create a new standard storage account and blob container in the same resource group.
Copy VHD to the new storage account, you could use Azcopy.
AzCopy /Source:https://shuidisks446.blob.core.windows.net/vhds /Dest:https://shuidiag102.blob.core.windows.net/vhds /SourceKey:sGqtdFHQWQWYyf2tRWGF5jkeAEubTp13AVaeTM25QogxXE+K0Ezq1ulcs18qGVPhCEp6ULdLLbKVa7fMbUvYZg== /DestKey:iCjeS+eegjkSJXHjH2UqCkqXnUPiCGvxaOG0Ad2LoPgUnvBoWl9wQJtC1jc//lOj4CF7khpLQe791P4QeyTY6Q== /Pattern:shui20161222141315.vhd
More information about Azcopy please refer to this article.
Use the VHD to create a D series VM. It is easy for you to recreate with existing VHD by using this template
Delete your Premium Storage Account.

How to replace os disk with attached data disk on azure virtual machine

I attached a new vhd file to my virtual machine but I could not find a way to boot that machine with this disk. How can I boot my virtual machine with newly attached data disk?
Edit: I found the way of creating of vm from captured vm image. It is preformed on VM Images section. Now my problem is that when I transfer the captured page blobs from one azure account to another account they appear on storage account section but not on VM Images section. Hence I am not able to create VM from transferred images. How can I make this blobs appear on VM Image or is there a way to transfer VM Image disk directly to the section of VM Images of another azure account by using azure-cli?
I would like to create OS Disk from a vhd file. In microsoft documents here as it mentioned there is a command azure vm image create in my azure-cli there is no such command. I could not find a way to make an OS Disk from my stored vhd files.
Solved: Using classic portal of Azure it is easy to create vm images or os disks and creating vms from these images.
Here is a link to get disk up and running, check the section 'Initialize the disk'.
Source : https://azure.microsoft.com/en-gb/documentation/articles/virtual-machines-windows-classic-attach-disk/

Will my files will be lost if I stop and restart my Microsoft Azure Virtual Machine

Will my files and database will be lost if I stop or restart or my VM get crashed certainly.
Can the files created at VM be stored in my computer hard disk so that I can retrieve them in future, if I need.
If your VM get crashed you will not be able to access your VM as well as your data but that doesn't mean you will loss your data. Your data will be stored there in the blob storage.
What you need to do is- attach the blob storage properly to some other vm or new vm to access it again.
As previously mentioned this was answered on another thread, the best thing to do is to download the VHD locally.
From the Windows Azure Portal you can easily download the VHD. Just navigate to STORAGE and then the storage account in which your virtual disk is created. Select CONTAINERS (at the top), open the container named "vhds". Just click the vhd you want and select DOWNLOAD (at the bottom of the page).
Have a great day

creating image windows azure without deleted virtual machine?

I have an instance medium in windows azure.
I need an image to make new instance large, so when I create an image, It say you must delete it as part of operation.
So, how can i make image instance medium without deleting current virtual machine??
note: Amazon cloud service can make image without deleting instance. That includes microsoft server.
Actually how to do create image with minimum downtime. That's the true purpose of this question.
There are a couple of objectives I read from this. The first is that you want to make a medium instance large. You can change the size of a virtual machine without deleting it. Go to the configure tab for the VM and change the size. This will require a reboot, but it will keep your virtual machine in tact.
The second is to create an image with minimum downtime. As you know, this is not possible without destroying your existing VM. The details of sysprepping a machine are the reason (won't go into those details here). You could create a new virtual machine from your existing one and sysprep that copy though. At least that way you're not losing any downtime while you're creating the image. Not sure how helpful that is for your scenario. Personally, I would just re-size your existing VM if that's all you need. Regardless, here are the steps.
Copy the VHD to a backup container in the same storage account.
Create a new disk from the copy of the VHD.
Create a new virtual machine based off the new disk. You can also specify the size at this step too.
Login and sysprep the new virtual machine.
Shutdown and capture the image of the new virtual machine.
This will get you an image without impacting your existing VM.
There are two types of images: Specialized and Generalized.
You can check the detail in VM Image.
For your scenario, you want to change the size of your vm. So you'll need a Generalized image which has been removed the original provision data, such as vm size, the admin user password, etc.
But in order to capture a Generalized image, you have to do deprovision on the original running vm.
For Windows in Azure:
%windir%\system32\sysprep\sysprep.exe /generalize /shutdown /oobe
For Linux in Azure:
$ sudo waagent –force –deprovision
$ shutdown –h now
Note: After deprovison, the original VM is useless for you and just like an orphan, and you lost the control for it since it has been removed a lots of original provision data. That's why Azure deletes the vm automatically after capturing image successfully.
I agree with you AWS EC2 is more powershell than Azure. A lot of services are inconvenient in Azure.
There is VHD blob container which contains your VM OS disk and VM data disks. You can copy the data disks and attach to any VM.
When you are creating the image, you need to do sysprep which deletes everything from your VM even login. So anyways your VM is of no use. Now once the image is there you can create your VM selecting the image which you have created and data disk if you want old data to be there also. And you can create as many copies as you want.

How do I migrate an existing Windows Azure VM to a Windows Azure virtual network?

I would like to migrate our test server - a Windows Azure VM running Windows 2008 server (running AD DC and variety of apps such as Dynamics CRM) - to a virtual network.
I am looking for a safe way to migrate the server to the virtual network.
My research to date indicates that I can create a new VM using the same OS disk. However when I attempt to create a new VM the existing OS disk is not visible in the list of images.
Is anybody able to point me in the right direction as to how this is achieved? Also, do you have any recommendations with respect to a rollback strategy (e.g. Backup tools)?
Alan.
I haven't verified the flow, but it should be working fine. Follow these steps:
Make sure you are not using static IP on your AD/DC. The IP Addresses in Azure shall always be DHCP allocated!
Shut down the AD/DC
Copy the VHD blob to a new blob! I strongly suggest that you have the OS Disk (VHD blob) in a storage account which is in the same affinity group as the Virtual Network. So, if the current OS Disk is not in a Storage Account, which is in the same affinity group as the VNet, create a new storage account and copy the original VHD there. Please note that you should copy the blob only when the VM is shut down!
Create the sub-net you want to bring the VM in. (probably you already have created it).
Create a new VM using the copied VHD as an OS Disk and selecting the Virtual Network and sub-net.
Possible gotchas with this migration:
IP Address of AD/DC will change when added to the Virtual Network. Be prepared and never assign static IP Address to a VM in Azure
You will not see the VHD in the list of possible images to use - in that case use some kind of storage explorer (such as Cloud Storage Studio) to make sure there is no existing lease on the blob with the VHD. If there is a lease - break it!
A suggested VNet setup for AD/DC/DNS infrastructure in azure is clearly described in this blog post

Resources