This is a step by step tutorial on how to get your (existing) VM hosted on Azure. Let me put it this way: there’s room for simplification. …
Step 1: Get your certificates
I assume that you have an active Azure subscription and you have installed visual studio 2010, the azure sdk and tools and activated the VM role. You will need a management certificate for your subscription to deploy services and 1 or more service certificates to communicate with those securely. To generate a x509 certificate for use with the management API:
1. Open the IIS manager, click on your server.
2. Select "Server Certificates" in the main panel.
3. Click "Create Self-Signed Certificate" in the actions panel
4. Give the certificate a friendly name.
5. Close IIS manager and run certmgr.msc
6. Find your certificate in "Trusted Root Certification Authorities"
7. Right-Click on it, select All Tasks / Export
8. Do not export the private key, choose the DER format, give it a name.
9. Navigate to the Windows Azure management portal.
10. Select Hosted Services / Management Certificates / Add a Certificate
11. Browse to the management certificate file and upload it.
Step 2: Prepare the VM
I assume that you are familiar with Hyper-V and how to build a virtual machine on a hyper-v host.
1. Create a virtual machine on hyper-v. Note that the maximum size of virtual hard disk you specify will determine what size of Azure VM you will be able to choose. An extra-small machine will mount a vhd up to 15 GB, small one up to 35 and medium or more up to 65 GB. This is just the size of the system VHD. You will still receive local storage, mounted as a separate volume.
2. Install Windows Server 2008 R2 on the VHD. It is the only supported o/s as of writing.
3. Install the Azure integration components in the VM. They are contained in the wavmroleic.iso file, which is typically located in c:\progam files\windows azure sdk\<version>\iso. You need to mount that file on the VM and then run the automatic installation process. This provisions the device drivers and management services required by the Azure hypervisor and fabric controller. Note that the setup process asks you for a local administrator password and reboots the VM. The password is encrypted and stored in c:\unattend.xml for future unattended deployment.
4. Install and configure any application, role or update as you normally would.
5. Configure the windows firewall within the VM to open the ports that your application requires. It is recommended that you use fixed local ports.
6. Open and administrator command prompt and run c:\windows\system32\sysprep\sysprep.exe
7. Select "OOBE", Generalize and Shutdown
This process removes any system-specific data (including the name and SID) from the image, in preparation for re-deployment on Azure. If your application is dependent on those data, you will have to take appropriate measures at startup on Azure (e.g. run a setup script for your application). The VHD is now ready to be uploaded. It is recommended to make a copy of it to keep as a template.
Note that any deployment to Azure starts from this vhd. No status is saved to local disk if the Azure VMs is recycled for any reason.