A VM Role is configured as a Role within a larger Hosted Service. This is no different from a Web or Worker role except for the additional steps of creating and uploading the base VHD that the Role instances will be provisioned from.
The following example uses Visual Studio 2010 with the Azure SDK Installed to define and publish the service. It is important that the latest Azure SDK is installed, the VM Role capability is enabled, and Visual Studio is already configured to manage your subscription.
Create the VM Image
-
Begin by creating a VM using Hyper-V
-
The VHD size cannot exceed 15 Gb for an Extra Small VM, 30 GB for a Small VM, or 64 GB for a Medium to Extra Large VM.
-
-
Install Server 2008 R2
-
Apply Windows Updates
-
Add .Net Framework 3.5.1
-
-
Install and configure your application(s)
-
Be aware that the image will be prepared with sysprep. When provisioned, the VM will be unique and will complete mini setup. Therefore the application must be in a state that is compatible with sysprep. Any additional configuration that must be performed after mini-setup is complete should be scripted using a custom service, or defining Syncronous Commands in the unattend.xml created by step 4.
-
-
Install the Azure VM Integration Components.
-
This generates an unattend.xml at the root of the system drive (with the Administrator password prompted for). This unattend.xml is very specific to the VM successfully provisioning on Azure. Sections can be added to the XML file, but not deleted.
-
Install Azure Connect endpoint agent if it will be used.
-
Apply any modifications to the unattend.xml to support installing or configuring your application.
-
A combination of scripts or commands and the FirstLogonCommands and SynchronousCommand keys can be combined with the AutoLogon to orchestrate the actions.
-
-
Run sysprep to generalize the image
-
sysprep /generalize /oobe /shutdown /unattend:"C:\unattend.xml"
Upload the VM (vhd) image
-
Upload the VHD using the csupload tool that is included with the SDK. This is accessed by launching the SDK Command prompt using "Run As Administrator".
Author and Deploy an Azure Service
-
http://msdn.microsoft.com/en-us/library/gg465379.aspx
-
External endpoints are ports that are available publically in front of the load balancers and mapped to a particular role.
-
Internal endpoints are available behind the load balancers and can be used to define specific endpoints (open TCP ports) for machine to machine communication.
-
Be aware that you cannot use FQDNs or DNS or the like – the intercommunication involves enumeration of role instances using Azure Service Runtime components combined with proper configuration using IP addresses.
-