John Joyner demonstrates the final steps to building a working VM role in the Azure public cloud — deploying the service package using the Windows Azure Platform Management Portal.
In a previous article, using Microsoft Visual Studio, we created the service model for your Azure virtual machine (VM) role and generated the service package files. We are ready to perform the final step that produces a working VM role in the Azure public cloud, deploying the service package to your Azure subscription using the Windows Azure Platform Management Portal.
Create the Hosted Service
We resume work immediately following the step where Visual Studio compiled the two service package files and opened an Explorer window to the file publish location, typically <current user profile>\Documents\Visual Studio 2010\Projects\<Azure Project Name>\<Azure Project Name>\bin\Debug\Publish.
1. The Service Package file (.cspkg) and the Cloud Service Configuration file (.cscfg) are ready in the publish location to upload to the Azure Management Portal to complete the VM role deployment process in the following steps.
2. Also prepared for the following steps is a copy of the Remote Desktop Protocol (RDP) authentication certificate that was exported with the private key to a suitable location in your hard disk.
3. Return to your browser window, still open to your Azure Management Portal (https://windows.azure.com).4. Navigate to the Hosted Services, Storage Accounts & CDN pane and push the New Hosted Service button in the ribbon as shown in Figure A. Enter the following information:
- Service name is internal to your organization and can have any meaning you desire.
- URL prefix for your service is critical. This prefix is the DNS host name that will be used to access your VM role over the Internet, therefore, it needs to be unique and can only contain characters that are valid in a URL. The dialog validates the name as you type it and warns you if the name you choose has already been taken.
- Region or affinity group must match the Azure datacenter(s) where you uploaded the Virtual Hard Drive (VHD) image previously.
- Deployment option needs to be "Do not deploy" at this stage. Press OK to create the hosted service.
Figure A - Creating a new hosted service is where the public DNS name for the VM role is specified5. Now upload the copy of the Remote Desktop Protocol (RDP) authentication certificate that was exported with the private key. Navigate to the hosted service you just created, select the Certificate node, and press the Add Certificate button in the ribbon as shown in Figure B.
Figure B - Uploading the RDP authentication certificate to the hosted service.
6. Browse to the certificate file (with a .PFX file extension), enter the password used when the certificate copy was exported, and press OK to add the certificate.7. Ready to spin up a VM? Still in the Hosted Services pane of the Azure Management Portal, select the hosted service you just created and push the New Production Deployment button in the ribbon. The Create A New Deployment dialog box will appear as shown in Figure C.
Figure C - Spinning up the VMs: Deploying production VM instances of the VM role.
8. After entering a deployment name of your selection, push the Browse Locally button next to Package Location and locate the Service Package file (.cspkg). Repeat this step with the Configuration File, and locate the ServiceConfiguration.cscfg file.
9. Press OK and the deployment process will start. You can track the various states of your deployment, such as Initializing... and Starting Host. Wait until the status of the deployment is shown as Ready.
Test the hosted service
After your hosted service starts successfully, your VM role is running, and it's ready to test and use. If your Azure VM role application publishes one or more TCP ports to the Internet, you can test that access immediately. Like any Windows Azure application, the Azure cloud service handles the DNS, firewall, routing, and load balancing work needed to deploy your VM role.For example, if you enabled HTTP (TCP port 80) access to your Azure VM role application, and if your VM's VHD image includes a default installation of Internet Information Services (IIS), you can try and browse to the default website. Open your web browser, and for the URL, type the host name you selected in step 4.b of this article (literally ‘http://PublicDnsHostName.cloudapp.net' in this example). You should see the "Welcome to IIS7" banner in your browser, delivered by your Windows Azure VM role!