In a previous article, I covered preparing and uploading the base Virtual Hard Drive (VHD) image for your Microsoft Windows Azure VM role. In that article, we used Hyper-V to create a Windows 2008 R2 VHD image, customized it by adding Azure Integration Components, prepared it with the Sysprep.exe utility, and uploaded it to Azure using the Add-VMImage cmdlet in the Azure SDK (Software Development Kit). The source for the integration components (and the location for performing the upload task) is your Azure administration workstation. On this workstation, you have installed Visual Studio 2010 and the Azure SDK. We will use the administration workstation to complete the final two tasks:
- Create a service model and configure it to use the uploaded image using Microsoft Visual Studio.
- Generate a service package with Visual Studio, and deploy the package configuration files to your subscription using the Windows Azure Platform Management Portal.
Initial steps to create the service model
After uploading your base VHD image, the image is deployed to your Windows Azure subscription, however no VM roles are yet created to use that image. To build VM roles from the base image, you need to create a service model in Visual Studio. Here are the steps to follow after starting Microsoft Visual Studio on your Azure administration workstation.
- Create a new Windows Azure Project. (Installing the Azure SDK on the administration workstation adds this project type to the ‘new project creator’ in Visual Studio 2010.)
- You will not add any Web or Worker Roles to your VM application because VMs don’t have startup code associated with them that would otherwise be added to an Azure solution.
- Right-click on the Role folder and select to Add a New Virtual Machine Role.
- The first thing you will see is a prompt for a Virtual Hard Disk (VHD). You will need to click on Add to create your Windows Azure Account credentials.
- In the prompt to create or select a certificate, scroll to the bottom of the selection list and select Create. (This process makes sure that every Azure customer digital credential is unique and authentic-you supply the actual certificate that will be used to secure access to your Azure application.)
- Supply a friendly name for your selection, and then select the certificate you just created-recognizing it by its friendly name. The wizard saves a copy of the certificate file to a temporary folder on local hard drive.
- Click on the ‘Copy the full path’ link in the wizard to copy the path of the certificate file on your local hard drive to the clipboard. Paste the path name into a notepad window; you’ll need it in a moment. See this link in step 2 of Figure A.
- Next click on the handy link to the Windows Azure Portal in second part of step #2 shown in Figure A. This link opens the online customer portal for your Azure subscription in your browser.
- Inside your web browser, navigate in the portal to the Hosted Services, Storage Accounts & CDN option, click Management Certificates, and then click Add Certificate on the ribbon.
- Copy the path to the certificate from notepad to your clipboard, and paste the path where indicated in Figure B. Clicking OK uploads the certificate to Azure.
- After uploading the certificate file to Azure, click on the Subscription ID where you created the certificate (circled on the right side of Figure B). Copy the ID code to your clipboard, it will be needed in the next step.
- Return to the Windows Azure Project Management Authentication setup page (Figure A) and paste the Subscription ID in the step #3 field.
- Finally, enter a friendly name for this Azure management credential on the bottom line and push OK.
After performing these steps, your online Azure VM subscription is now linked to this Visual Studio application. That linkage makes the base VHD images you have uploaded to this Azure subscription available to select for use as shown in Figure C. You are ready to proceed with additional customization of the Azure VM role application, and creation of the service package that completes the process.